oncheckpoint event

Applies to Windows and Windows Phone

Occurs when receiving Process Lifetime Management (PLM) notification or when the checkpoint function is called.


WinJS.Application.addEventListener("checkpoint", listenerName);
WinJS.Application.oncheckpoint = listenerName;

Event information


Event handler parameters


Type: CustomEvent

An object that contains information about the event. The detail property of this object includes the following subproperties:

  • type: "checkpoint"
  • setPromise: The Promise indicates that the event listener has pending asynchronous work. When the Promise is completed, the next handler is dispatched.


The system suspends your app whenever the user switches to another app. The system resumes your app whenever the user switches back to it. When the system resumes your app, the content of your variables and data structures is the same as it was before the system suspended the app.

The system restores the app exactly where it left off, so that it appears to the user as if it's been running in the background. The system attempts to keep your app and its data in memory while it's suspended. However, if the system does not have the resources to keep your app in memory, the system terminates your app. When the user switches back to a suspended app that has been terminated, the app receives an activated event and should check whether its session state objects are defined. If the objects are defined, the app should load that data.

The system doesn't notify an app when it's terminated, so your app needs to save its application data and release exclusive resources and file handles when it's suspended, and it must restore them when the app is activated after termination.

You should also release any exclusive resources, like file handles at suspend, so that they can be used by other apps while your app is suspended.

For more information about the application lifecycle, see Guidelines for managing the app lifecycle.


The following code is based on the code used in the Visual StudioJavaScript project templates. It shows how to set the WinJS.Application.sessionState object in this event handler.

// This is an example of an object that is relevant to the state of your app.
var exampleObject = null;
var app = WinJS.Application;

app.onactivated = function (args) {
    if (args.detail.kind === activation.ActivationKind.launch) {
        if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
            // TODO: This application has been newly launched. Initialize
            // your application here.
            exampleObject = { exampleState: "running" }; 

app.oncheckpoint = function (args) {
    // WinJS.Application.sessionState object, which is automatically
    // asynchronous operation before your application is suspended, call
    // args.setPromise().

    // Set the sessionState object to the example object.
    app.sessionState = exampleObject;

 Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", function (args) {
    if (WinJS.Application.sessionState)
        // Reset the example object to the saved state.
        exampleObject = WinJS.Application.sessionState;
}, false);


Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1





See also

How to suspend an app
WinJS.Application Namespace



© 2014 Microsoft