lifecycle module

Note

This namespace is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

A namespace for enabling the suspension or delayed termination of an app when the user navigates away. When an app registers for the registerBeforeSuspendOrTerminateHandler, it chooses to delay termination. When an app registers for both registerBeforeSuspendOrTerminateHandler and registerOnResumeHandler, it chooses the suspension of the app . Please note that selecting suspension doesn't guarantee prevention of background termination. The outcome is influenced by factors such as available memory and the number of suspended apps.

Type Aliases

registerBeforeSuspendOrTerminateHandlerFunctionType

Register before suspendOrTerminate handler function type

registerOnResumeHandlerFunctionType

Register on resume handler function type

Functions

registerBeforeSuspendOrTerminateHandler(registerBeforeSuspendOrTerminateHandlerFunctionType)

Registers a handler to be called before the page is suspended or terminated. Once a user navigates away from an app, the handler will be invoked. App developers can use this handler to save unsaved data, pause sync calls etc.

registerOnResumeHandler(registerOnResumeHandlerFunctionType)

Registers a handler to be called when the page has been requested to resume from being suspended.

Function Details

registerBeforeSuspendOrTerminateHandler(registerBeforeSuspendOrTerminateHandlerFunctionType)

Registers a handler to be called before the page is suspended or terminated. Once a user navigates away from an app, the handler will be invoked. App developers can use this handler to save unsaved data, pause sync calls etc.

function registerBeforeSuspendOrTerminateHandler(handler: registerBeforeSuspendOrTerminateHandlerFunctionType)

Parameters

handler
registerBeforeSuspendOrTerminateHandlerFunctionType

The handler to invoke before the page is suspended or terminated. When invoked, app can perform tasks like cleanups, logging etc. Upon returning, the app will be suspended or terminated.

registerOnResumeHandler(registerOnResumeHandlerFunctionType)

Note

This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Registers a handler to be called when the page has been requested to resume from being suspended.

function registerOnResumeHandler(handler: registerOnResumeHandlerFunctionType)

Parameters

handler
registerOnResumeHandlerFunctionType

The handler to invoke when the page is requested to be resumed. The app is supposed to navigate to the appropriate page using the ResumeContext. Once done, the app should then call notifySuccess.