Skip to content

Instantly share code, notes, and snippets.

@purplecabbage
Forked from brianleroux/stopgap.js
Created October 6, 2011 19:42
Show Gist options
  • Save purplecabbage/1268431 to your computer and use it in GitHub Desktop.
Save purplecabbage/1268431 to your computer and use it in GitHub Desktop.
alunny's stopgap in gist form
(function () {
function deviceready() {
var e = document.createEvent('Events')
e.initEvent('deviceready')
document.dispatchEvent(e)
}
if (PhoneGap) {
PhoneGap.exec = function(success, fail, service, action, args){
var callbackId = service + PhoneGap.callbackId++;
if (typeof success == "function" || typeof fail == "function") {
PhoneGap.callbacks[callbackId] = {success:success, fail:fail};
}
var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
console.log(command);
};
deviceready();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment