Creating Namespace in WinJS for Windows Store App ?

When developing Windows Store App using WinJS library , there are times when you want to create a namespace . You can use the WinJS.Namespace.define() method to create a namespace. Below is a sample code snippet demonstrating how to create a namespace in WinJS for Windows Store App using WinJS.

Creating Namespace in WinJS for Windows Store App ?

(function () {
    "use strict";
    console.log("Welcome to");
    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.

    app.oncheckpoint = function (args) {
        // TODO: This application is about to be suspended. Save any state
        // that needs to persist across suspensions here. You might use the
        // WinJS.Application.sessionState object, which is automatically
        // saved and restored across suspension. If you need to complete an
        // asynchronous operation before your application is suspended, call
        // args.setPromise().


Leave Your Comment

Liked this content?. Please spread the word :)