Deferred.d.ts
76 lines
| 1.9 KiB
| video/mp2t
|
TypeScriptLexer
cin
|
r2 | import { PromiseCallback, DojoPromise, PromiseErrback, PromiseProgback } from "./promise/Promise"; | ||
declare namespace dojoDeferred { | ||||
interface Deferred<T> { | ||||
/** | ||||
* The public promise object that clients can add callbacks to. | ||||
*/ | ||||
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>; | ||||
/** | ||||
* Add new callbacks to the deferred. | ||||
*/ | ||||
then<U>(callback?: PromiseCallback<T, U>, errback?: PromiseErrback<U>, progback?: PromiseProgback): DojoPromise<U>; | ||||
/** | ||||
* Inform the deferred it may cancel its asynchronous operation. | ||||
*/ | ||||
cancel(reason?: any, strict?: boolean): any; | ||||
/** | ||||
* Returns `[object Deferred]`. | ||||
*/ | ||||
toString(): string; | ||||
} | ||||
interface DeferredConstructor { | ||||
/** | ||||
* Creates a new deferred. This API is preferred over | ||||
* `dojo/_base/Deferred`. | ||||
*/ | ||||
new <T>(canceller?: (reason: any) => void): Deferred<T>; | ||||
prototype: Deferred<any>; | ||||
} | ||||
} | ||||
type dojoDeferred<T> = dojoDeferred.Deferred<T>; | ||||
declare const dojoDeferred: dojoDeferred.DeferredConstructor; | ||||
export = dojoDeferred; | ||||