Handling the Activated Event

The activated event is raised when a Windows Store app is activated (started). A Windows Store app can be activated in several different ways, and you can use the ActivationKind property to determine exactly how the app was activated:

WinJS.Application.addEventListener("activated", function (evt) {    var activationKind = Windows.ApplicationModel.Activation.ActivationKind;    switch (evt.detail.kind) {        case activationKind.launch:            console.log("Launched from a tile");            break;        case activationKind.search:            console.log("Activated from a search");            break;        default:            console.log("Activated for some other reason");    }}); ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.