Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vipera-npm-registry / de-core-plugin   js

Repository URL to install this package:

Version: 0.2.0 

/ www / de-core-security-plugin.js

var exec = require('cordova/exec');
var argscheck = require('cordova/argscheck');

/**
 * Redefine console log in roder to remove Chromium Logging
 * var console = {};
 * console.log = function(){};
 *
 */
function removeConsoleLog(){
    exec(function(result){
        if (result){
            console.log = function(){};
            console.info = function(){};
            console.error = function(){};
        } else {
           //leave the console log/error/info
        }
    }, function(err){
      console.error("Error: " + err);
    }, "DECoreSecurityPlugin", "isConsoleLogDisabled", [{}]);
}

removeConsoleLog();


/**
 * @namespace DynamicEngine.plugins.core.Security
 */

/**
 * @exports Security
 */
function Security(){

}


/**
* Check if the device is rooted (or jailbroken if iOS)
*
* @param {Function} success A success callback function called on success
* @param {Function} error The error callback function called on failure
*/
Security.prototype.isDeviceRooted = function (success,error) {
    exec(success, error, "DECoreSecurityPlugin", "isDeviceRooted", [{}]);
};

/**
* Check if a VPN is configured and active on the device
*
* @param {Function} success A success callback function called on success
* @param {Function} error The error callback function called on failure
*/
Security.prototype.isVPNSet = function(success, error) {
    exec(success, error, "DECoreSecurityPlugin", "isVPNSet", [{}]);
};

/**
* Check if a Porxy is configured and active on the device
*
* @param {Function} success A success callback function called on success
* @param {Function} error The error callback function called on failure
*/
Security.prototype.isProxySet = function(params, success, error) {
    exec(success, error, "DECoreSecurityPlugin", "isProxySet", [params]);
};

Security.prototype.disableConsoleLog = function(params, success, error){
    removeConsoleLog();
  }
  
module.exports = new Security();