Skip to content

Instantly share code, notes, and snippets.

@purplecabbage
Created November 18, 2014 19:22
Show Gist options
  • Save purplecabbage/fc1731a1e30db3e7a72e to your computer and use it in GitHub Desktop.
Save purplecabbage/fc1731a1e30db3e7a72e to your computer and use it in GitHub Desktop.
Prevent native calls, and do nothing on cordova.exec api calls.
var cordovaExec = cordova.exec;
var log = console.log;
cordova.exec = function(ftw, wtf, service, action, args) {
var cbId = service + cordova.callbackId++;
cordova.callbacks[cbId] = {success: ftw, fail: wtf};
log("Blocked call to : " + service + "/" + action);
log("Args to call were : " + JSON.stringify(args));
log('callbackId is ' + cbId);
}
log("cordova.exec has been plugged, in order to push a result, call : ");
log("cordova.callbackFromNative(callbackId, isSuccess, status, args, keepCallback);");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment