done method

WinJS.done function

[This documentation is preliminary and is subject to change.]

Applies to: Metro style apps only

Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. After the handlers have finished executing, this function throws any error that would have been returned from then as a promise in the error state.

Syntax

WinJS.done(onComplete, onError, onProgress);

Parameters

onComplete

Type: function

The function to be called if the promise is fulfilled successfully with a value. The fulfilled value is passed as the single argument. If the value is null, the fulfilled value is returned. The value returned from the function becomes the fulfilled value of the promise returned by then. If an exception is thrown while executing the function, the promise returned by then moves into the error state.

onError

Type: Function

The function to be called if the promise is fulfilled with an error. The error is passed as the single argument. If it is null, the error is forwarded. The value returned from the function is the fulfilled value of the promise returned by then.

onProgress

Type: Function

The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress.

Return value

This function does not return a value.

Requirements

Namespace

WinJS

Library

Base.js

See also

Promise

 

 

Build date: 2/10/2012

Ajouts de la communauté

AJOUTER
Afficher:
© 2017 Microsoft