code: function onWindowLoad() {
      if (self.isWebView()) {
        // the window and scripts are fully loaded, and a cordova/phonegap
        // object exists then let's listen for the deviceready
        document.addEventListener("deviceready", onPlatformReady, false);
      } else {
        // the window and scripts are fully loaded, but the window object doesn't have the
        // cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova
        onPlatformReady();
      }
      if (windowLoadListenderAttached) {
        window.removeEventListener("load", onWindowLoad, false);
      }
    }
docs: setup listeners to know when the device is ready to go