Promise.as method

4 out of 10 rated this helpful - Rate this topic

Returns a promise. If the object is already a Promise it is returned; otherwise the object is wrapped in a Promise.

You can use this function when you need to treat a non-Promise object like a Promise, for example when you are calling a function that expects a promise, but already have the value needed rather than needing to get it asynchronously.

Syntax


promise.as(value).done( /* Your success and error handlers */ );

Parameters

value

Type: Object

The value to be treated as a Promise.

Return value

Type: Promise

The promise.

Remarks


var promise = WinJS.Promise.as(nonPromise);

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

WinJS

Library

Base.js

See also

Promise

 

 

Build date: 12/5/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.