Compartilhar via


WinJS.Application.stop function

Stops application event processing and resets WinJS.Application to its initial state. All WinJS.Application event listeners (for the activated, checkpoint, error, loaded, ready, settings, and unload events) are removed.

Important  This function does not stop the execution of the app. For more information about the app lifecycle, see Part 2: Manage app lifecycle and state.

 

Syntax

WinJS.Application.stop();

Parameters

This method has no parameters.

Return value

This function does not return a value.

Examples

If you run the following, you will see "got loaded event", but not "got ready event" or "got activated event" in the JavaScript Console window in the Messages tab. If you comment out the call to WinJS.Application.stop, all of the WinJS.Application events occur.

   WinJS.Application.start();

    WinJS.Utilities.startLog("example");
    
    WinJS.Application.addEventListener("activated", function (ev) {
        WinJS.log && WinJS.log("got activated event", "example", "info");
    }, false);

    WinJS.Application.addEventListener("loaded", function (ev) {
        WinJS.log && WinJS.log("got loaded event", "example", "info");
        WinJS.Application.stop();

    }, false);

    WinJS.Application.addEventListener("ready", function (ev) {
        WinJS.log && WinJS.log("got ready event", "example", "info");
    }, false);

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Application