Occurs when WinRT activation has occurred. The name of this event is "activated" (and also "mainwindowactivated"). This event occurs after the loaded event and before the ready event.
Syntax
WinJS.Application.addEventListener("activated", listenerName);
or
WinJS.Application.onactivated = listenerName;
Event information
| Synchronous | No |
|---|---|
| Bubbles | Yes |
| Cancelable | Yes |
Event handler parameters
- eventInfo
-
Type: CustomEvent
An object that contains information about the event. For more information about event arguments, see the WinRT event argument classes:
- WebUICachedFileUpdaterActivatedEventArgs
- WebUICameraSettingsActivatedEventArgs
- WebUIContactPickerActivatedEventArgs
- WebUIDeviceActivatedEventArgs
- WebUIFileActivatedEventArgs
- WebUIFileOpenPickerActivatedEventArgs
- WebUIFileSavePickerActivatedEventArgs
- WebUILaunchActivatedEventArgs
- WebUIPrintTaskSettingsActivatedEventArgs
- WebUIProtocolActivatedEventArgs
- WebUISearchActivatedEventArgs
- WebUIShareTargetActivatedEventArgs
Remarks
Whenever your app is launched, the activated event is raised. This event can also be raised while your app is running if the system needs to pass the app parameters related to a new activation contract. You can use the activated event to restore the previous state of your app and to retrieve the activation parameters related to the contract for whichyour app is being activated. For a full list of the activation contracts and more details on their parameters see the ActivationKind enumeration.
Note : If your app needs to navigate the top level document for any reason you must first complete activation before attempting to do the top level navigation. If you attempt a top level navigation before activation completes your app will crash. This ensures that your app and the system are in a consistent state before the JavaScript context is torn down and recreated during the navigation.
For more information about the application lifecycle, see Guidelines for managing the app lifecycle.
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
WinJS.Application |
|
Library |
|
See also
- Tasks
- How to handle app activation
- Reference
- WinJS.Application Namespace
- Samples
- App activate and suspend using WinJS sample
Build date: 12/5/2012