default.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // For an introduction to the Navigation template, see the following documentation:
  2. // http://go.microsoft.com/fwlink/?LinkId=232506
  3. (function () {
  4. "use strict";
  5. var activation = Windows.ApplicationModel.Activation;
  6. var app = WinJS.Application;
  7. var nav = WinJS.Navigation;
  8. var sched = WinJS.Utilities.Scheduler;
  9. var ui = WinJS.UI;
  10. app.addEventListener("activated", function (args) {
  11. if (args.detail.kind === activation.ActivationKind.launch) {
  12. if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
  13. // TODO: This application has been newly launched. Initialize
  14. // your application here.
  15. } else {
  16. // TODO: This application has been reactivated from suspension.
  17. // Restore application state here.
  18. }
  19. nav.history = app.sessionState.history || {};
  20. nav.history.current.initialPlaceholder = true;
  21. // Optimize the load of the application and while the splash screen is shown, execute high priority scheduled work.
  22. ui.disableAnimations();
  23. var p = ui.processAll().then(function () {
  24. return nav.navigate(nav.location || Application.navigator.home, nav.state);
  25. }).then(function () {
  26. return sched.requestDrain(sched.Priority.aboveNormal + 1);
  27. }).then(function () {
  28. ui.enableAnimations();
  29. });
  30. args.setPromise(p);
  31. }
  32. });
  33. app.oncheckpoint = function (args) {
  34. // TODO: This application is about to be suspended. Save any state
  35. // that needs to persist across suspensions here. If you need to
  36. // complete an asynchronous operation before your application is
  37. // suspended, call args.setPromise().
  38. app.sessionState.history = nav.history;
  39. };
  40. app.start();
  41. })();