WinJS.Application.addEventListener function

Adds an event listener for application-level events: activated, checkpoint, error, loaded, ready, settings, and unload.
Syntax
WinJS.Application.addEventListener(type, listener, capture);
Parameters
- type
-
Type: string
The type (name) of the event. You can use any of the following:"activated", "checkpoint", "error", "loaded", "ready", "settings", and" unload".
- listener
-
Type: function
The listener to invoke when the event is raised.
- capture
-
Type: Boolean
true to initiate capture, otherwise false.
Return value
This function does not return a value.
Remarks
The following events can be added with this function:
-
"activated": For more information, see WinJS.Application.onactivated.
-
"checkpoint": For more information, see WinJS.Application.oncheckpoint.
-
"error": For more information, see WinJS.Application.onerror.
-
"loaded": For more information, see WinJS.Application.onloaded.
-
"ready": For more information, see WinJS.Application.onready.
-
"settings": For more information, see WinJS.Application.onsettings.
-
"unload": For more information, see WinJS.Application.onunload.
Examples
The following code shows how to add event listeners for different events.
WinJS.Application.addEventListener("activated", activated, false); Windows.UI.WebUI.WebUIApplication.addEventListener("suspending", suspending, false); Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resuming, false); WinJS.Application.addEventListener("unload", activated, false);
Requirements
|
Minimum WinJS version |
WinJS 1.0 |
|---|---|
|
Namespace |
WinJS.Application |