Skip to content

Instantly share code, notes, and snippets.

@chantalgo
Created May 25, 2013 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chantalgo/5647454 to your computer and use it in GitHub Desktop.
Save chantalgo/5647454 to your computer and use it in GitHub Desktop.
Default JS in WinJS
/*
args.detail.kind : shows the way the app was activated- value comes from the Windows.ApplicationModel.Activation.- ActivationKind enumeration.
== launch : when it comes from the Start screen
Windows.ApplicationMode.- Activation.ApplicationExecutionState enumeration tells the app how it was last running.
*/
// Note (function () { … })(); module pattern
(function (){
"use strict";
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !==
activation.ApplicationExecutionState.terminated) {
// TODO: This application has been newly launched. Initialize
// your application here.
} else {
// TODO: This application has been reactivated from suspension.
// Restore application state here.
}
args.setPromise(WinJS.UI.processAll());
/*
data-win-control : WinJS.UI.processAll instantiates any WinJS controls that are declared in HTML.
data-win-bind : processed by WinJS.Binding.processAll
data-win-res : processed by WinJS.Resources.processAll
*/
}
};
app.oncheckpoint = function (args) {
};
app.start();
/*
It makes sure that various events that were queued during startup get processed.
*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment