cordova-ourcodeworld-preven.../www/ourcodeworldpreventscreenshots.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-06-09 22:05:46 +08:00
/*global cordova, module*/
2016-06-09 22:36:44 +08:00
(function(module){
function PreventScreenshots(){
var core = {};
2016-06-09 23:14:14 +08:00
var isEnabled = true;
2016-06-09 22:05:46 +08:00
2016-06-09 22:36:44 +08:00
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;
2016-06-09 22:05:46 +08:00
}
2016-06-09 22:36:44 +08:00
module.exports = new PreventScreenshots();
})(module);