Dela via


WinJS.Application.start function

Starts dispatching application events (the activated, checkpoint, error, loaded, ready, settings, and unload events).

Syntax

WinJS.Application.start();

Parameters

This method has no parameters.

Return value

This function does not return a value.

Examples

You can see how this function is used in the default.js file that is part of all the project templates for Visual StudioJavaScript applications. If you run this code, you will see "got loaded event", "got ready event", and "got activated event" in the JavaScript Console window in the Messages tab. If you comment out the call to app.start, none of the WinJS.Application events occur, and you will not see the lines in the JavaScript Console.

    // In default.js:

    . . .

    app.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");

    }, 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