Skip to content

Instantly share code, notes, and snippets.

@Heshyo
Created July 2, 2015 07:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Heshyo/19cb259ed8ca033b3ca1 to your computer and use it in GitHub Desktop.
Save Heshyo/19cb259ed8ca033b3ca1 to your computer and use it in GitHub Desktop.
Fires "deviceready" when we're not inside a Cordova app
// Fakes the call of "deviceready". This can be useful for test purposes, but potentially also for the real website
// to avoid things like:
// if inside the app, call this method inside "deviceready"
// else call this method now.
(function () {
var oldAddEventListener = document.addEventListener;
document.addEventListener = function (eventName, callback) {
if (eventName === "deviceready") {
callback();
} else {
oldAddEventListener(eventName, callback);
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment