Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(arguments.length === 2) {
msg.pendingResult.result = arguments[1];
} else {
// The plugin returned a multipart message
var res = [];
for(var i = 1; i < arguments.length; i++) {
res.push(arguments[i]);
}
msg.pendingResult.result = res;
}
// Save the plugin result so that it can be delivered to the js
// even if they miss the initial firing of the event
lastResumeEvent = msg;
}
cordova.fireDocumentEvent(action, msg);
break;
default:
throw new Error('Unknown event action ' + action);
}
}
exec(function(cd){
switch(cd){
case "connected":
args.success(cd)
cordova.fireDocumentEvent("connected");
break;
case "disconnected":
args.error(cd)
cordova.fireDocumentEvent("disconnected");
break;
case "failure":
args.error(cd)
cordova.fireDocumentEvent("failure");
break;
}
}, function(e){
console.error(e)
onSuccess: function (result) {
console.log("subscribe:result:"+JSON.stringify(result));
if (!result.isInternetConnectionAvailable) {
if (navigator.onLine) {
console.log("Firing event:offline");
cordova.fireDocumentEvent("offline");
}
} else {
console.log("Firing event:online");
cordova.fireDocumentEvent("online");
}
},
onFailure: function(e) {
channel.join(function() {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
channel.join(function() {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
channel.onCordovaReady.subscribe(function() {
var prop = (event === 'error') ? event : 'data';
payload[prop] = data;
cordova.fireDocumentEvent(event, payload);
});
}
channel.join(function() {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
channel.join(function () {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
var pause = function() {
cordova.fireDocumentEvent('pause');
manager.pause();
};
channel.join(function() {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);