Deferred.d.ts
100 lines
| 2.6 KiB
| video/mp2t
|
TypeScriptLexer
cin
|
r2 | import DojoPromise = require("../promise/Promise"); | |
import { PromiseCallback, PromiseErrback, PromiseProgback } from "../promise/Promise"; | |||
cin
|
r15 | import declare = require("./declare"); | |
cin
|
r2 | ||
/* dojo/_base/Deferred */ | |||
interface Deferred<T> { | |||
promise: DojoPromise<T>; | |||
/** | |||
* Checks whether the deferred has been resolved. | |||
*/ | |||
isResolved(): boolean; | |||
/** | |||
* Checks whether the deferred has been rejected. | |||
*/ | |||
isRejected(): boolean; | |||
/** | |||
* Checks whether the deferred has been resolved or rejected. | |||
*/ | |||
isFulfilled(): boolean; | |||
/** | |||
* Checks whether the deferred has been canceled. | |||
*/ | |||
isCanceled(): boolean; | |||
/** | |||
* Emit a progress update on the deferred. | |||
*/ | |||
progress(update: any, strict?: boolean): DojoPromise<T>; | |||
/** | |||
* Resolve the deferred. | |||
*/ | |||
resolve(value?: T, strict?: boolean): DojoPromise<T>; | |||
/** | |||
* Reject the deferred. | |||
*/ | |||
reject(error?: any, strict?: boolean): DojoPromise<T>; | |||
/** | |||
* The results of the Deferred | |||
*/ | |||
results: [T, any]; | |||
/** | |||
* Adds callback and error callback for this deferred instance. | |||
*/ | |||
addCallbacks<U1, U2 = never>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>): Deferred<U1 | U2>; | |||
/** | |||
* Add new callbacks to the deferred. | |||
*/ | |||
then<U1, U2 = never>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): DojoPromise<U1 | U2>; | |||
/** | |||
* Cancels the asynchronous operation | |||
*/ | |||
cancel(): void; | |||
/** | |||
* Adds successful callback for this deferred instance. | |||
*/ | |||
addCallback<U>(callback: PromiseCallback<T, U>): Deferred<U>; | |||
/** | |||
* Adds error callback for this deferred instance. | |||
*/ | |||
addErrback<U>(errback: PromiseErrback<U>): Deferred<U>; | |||
/** | |||
* Add handler as both successful callback and error callback for this deferred instance. | |||
*/ | |||
addBoth<U>(callback?: PromiseErrback<U>): Deferred<U>; | |||
fired: number; | |||
} | |||
interface DeferredConstructor { | |||
/** | |||
* Deprecated. This module defines the legacy dojo/_base/Deferred API. | |||
* New code should use dojo/Deferred instead. | |||
*/ | |||
new <T>(canceller?: (reason: any) => void): Deferred<T>; | |||
prototype: Deferred<any>; | |||
/** | |||
* Transparently applies callbacks to values and/or promises. | |||
*/ | |||
when<T>(valueOrPromise: any): Deferred<T>; | |||
when<T, U1, U2 = never>(valueOrPromise: any, callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): Deferred<U1 | U2>; | |||
} | |||
declare const Deferred: DeferredConstructor; | |||
export = Deferred; |