Пример #1
0
 storage.internal.set({'version': version, 'shutdownClean': false}, function() {
   // Add some additional startup events if the app was not shut down properly
   // last time, or if it has been upgraded, or if it has just been intstalled.
   if (restart) {
     app_runtime.onRestarted.fire();
   }
   if (installDetails) {
     runtime.onInstalled.fire(installDetails);
   }
   // If launching for UI, fire onLaunched event
   var exec = require("cordova/exec");
   exec(function(data) {
     // lifeCycleEventFuncs would determine if app is started from an alarm, notification, etc.
     if (data && !exports.lifeCycleEventFuncs.length) {
       app_runtime.onLaunched.fire();
       // Log a warning if no window is created after a bit of a grace period.
       setTimeout(function() {
         var app_window = require('org.chromium.bootstrap.app.window');
         if (!app_window.current()) {
           console.warn('No page loaded because chrome.app.window.create() was never called.');
         }
       }, 500);
     }
     for (var i = 0; i < exports.lifeCycleEventFuncs.length; ++i) {
       exports.lifeCycleEventFuncs[i]();
     }
     exports.lifeCycleEventFuncs = null;
   }, null, "ChromeBootstrap", "doesNeedLaunch", []);
 });
Пример #2
0
 bootstrap.onBackgroundPageLoaded.subscribe(function() {
   runtime.onInstalled.fire(installDetails);
 });