mirror of
https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git
synced 2025-01-19 05:22:51 +08:00
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/*global cordova, module*/
|
|
(function(module){
|
|
function PreventScreenshots(){
|
|
var core = {};
|
|
var isEnabled = true;
|
|
|
|
var callFunctionIfExists = function(fn,params){
|
|
if(typeof(fn) !== "function"){
|
|
return false;
|
|
}
|
|
|
|
fn.call();
|
|
return true;
|
|
};
|
|
|
|
core.enable = function(success,error){
|
|
cordova.exec(function(data){
|
|
isEnabled = true;
|
|
callFunctionIfExists(success);
|
|
}, function(err){
|
|
callFunctionIfExists(error);
|
|
}, "OurCodeWorldpreventscreenshots", "enable", []);
|
|
};
|
|
|
|
core.disable = function(success,error){
|
|
cordova.exec(function(data){
|
|
isEnabled = false;
|
|
callFunctionIfExists(success);
|
|
}, function(err){
|
|
callFunctionIfExists(error);
|
|
}, "OurCodeWorldpreventscreenshots", "disable", []);
|
|
};
|
|
|
|
core.isEnabled = function(){
|
|
return isEnabled;
|
|
};
|
|
|
|
return core;
|
|
}
|
|
|
|
module.exports = new PreventScreenshots();
|
|
})(module);
|