Windows Dev Center

WebUIApplication.suspending event

Occurs when the app is suspending.


function onSuspending(eventArgs) { /* Your code */ }
// addEventListener syntax
webUIApplication.addEventListener("suspending", onSuspending);
webUIApplication.removeEventListener("suspending", onSuspending);
- or -

webUIApplication.onsuspending = onSuspending;

Event information

Delegate SuspendingEventHandler


The system suspends your app whenever the user switches to another app or to the desktop. 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 must save its application data and release exclusive resources and file handles when it's suspended, and 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. Your app can also listen to the Oncheckpoint event to handle the app being suspended.

Note   If you need to do asynchronous work when your app is being suspended, you will need to defer completion of suspend until after your work completes. You can use the suspendingOperation.getDeferral method to delay completion of suspend until after you complete the deferral.

Requirements (device family)

Device family


API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0





Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]





See also

How to suspend an app
Oncheckpoint event
App activated, resume, and suspend using the WRL sample



© 2015 Microsoft