Поделиться через


WinJS.Application Namespace

Provides application-level functionality, for example activation, storage, and application events.

The WinJS.Application namespace has these types of members:

  • Objects
  • Methods
  • Functions
  • Events

Objects

Object Description

local object

The local storage of the application.

roaming object

The roaming storage of the application.

sessionState object

An object used for storing app information that can be used to restore the app's state after it has been suspended and then resumed.

Data that can usefully be contained in this object includes the current navigation page or any information the user has added to the input controls on the page. You should not add information about customization (for example colors) or user-defined lists of content.

temp object

The temp storage of the application.

 

Methods

Method Description

setPromise method

Informs the application object that asynchronous work is being performed, and that this event handler should not be considered complete until the promise completes. This function can be set inside the handlers for all WinJS.Application events:

 

Functions

Function Description

addEventListener function

Adds an event listener for application-level events: activated, checkpoint, error, loaded, ready, settings, and unload.

checkpoint function

Queues a checkpoint event.

queueEvent function

Queues an event to be processed by the WinJS.Application event queue.

removeEventListener function

Removes an event listener from the WinJS.Application object.

start function

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

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.

 

Events

Event Description

onactivated event

Occurs when Windows Runtime 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.

onbackclick event

Raised when the users clicks the backbutton on a Windows Phone.

oncheckpoint event

Occurs when receiving PLM notification or when the checkpoint function is called.

onerror event

Occurs when an unhandled error has been raised.

onloaded event

Occurs after the DOMContentLoaded event, which fires after the page has been parsed but before all the resources are loaded. This event occurs before the activated event and the ready event.

onready event

Occurs when the application is ready. This event occurs after the onloaded event and the onactivated event.

onsettings event

Occurs when the settings charm is invoked.

onunload event

Occurs when the application is about to be unloaded.

 

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Application