Skip to main content
setPromise method

Applies to Windows and Windows Phone

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 called inside the handlers for all WinJS.Navigation events:

Syntax


ev.detail.setPromise(promise);

Parameters

promise

Type: Promise

The promise that should complete before processing is complete.

Return value

This method does not return a value.

Examples

The following code shows how to use this method inside an event handler.


WinJS.Navigation.onbeforenavigate = function (ev) {
    ev.detail.setPromise(
        WinJS.Application.roaming.writeText("navfile.txt", "starting navigation at: " + new Date())
    );
};

Requirements

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

Namespace

WinJS.Navigation

Library

Base.js

See also

For developers
WinJS.Navigation Namespace
WinJS.UI.Hub object
WinJS.UI.AppBar object
WinJS.UI.NavBar object
WinJS.UI.BackButton object
Your first app - Part 3: PageControl objects and navigation
Navigating between pages
Adding app bars
Quickstart: Using single-page navigation
Quickstart: Adding a nav bar (NavBar)
Quickstart: Using a hub control for layout and navigation
HTML Hub control sample
HTML AppBar control sample
HTML NavBar control sample
Navigation and navigation history sample
For designers
Navigation patterns
Command patterns
Layout
Hub
Bottom app bar
Top app bar
Back button
Guidelines for the hub control
Guidelines for app bars
Making the app bar accessible