##// END OF EJS Templates
added djbase mixins declaration support
added djbase mixins declaration support

File last commit:

r2:8ec37bf1b4d1 default
r32:1174538197f6 v1.0.0-rc15 default
Show More
Promise.d.ts
68 lines | 1.8 KiB | video/mp2t | TypeScriptLexer
declare namespace DojoPromise {
interface Thenable<T> extends PromiseLike<T> {
/**
* Add new callbacks to the promise.
*/
then<U1, U2>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): Thenable<U1 | U2>;
}
type PromiseCallback<T, U> = ((value: T) => U | PromiseLike<U>) | undefined | null;
type PromiseErrback<U> = PromiseCallback<any, U>;
type PromiseProgback = (progress: any) => void;
interface DojoPromise<T> extends Thenable<T> {
/**
* Inform the deferred it may cancel its asynchronous operation.
*/
cancel(reason?: any, strict?: boolean): any;
/**
* Checks whether the promise has been resolved.
*/
isResolved(): boolean;
/**
* Checks whether the promise has been rejected.
*/
isRejected(): boolean;
/**
* Checks whether the promise has been resolved or rejected.
*/
isFulfilled(): boolean;
/**
* Checks whether the promise has been canceled.
*/
isCanceled(): boolean;
/**
* Add a callback to be invoked when the promise is resolved
* or rejected.
*/
always<U>(callbackOrErrback: PromiseCallback<any, U>): DojoPromise<U>;
/**
* Add new errbacks to the promise.
*/
otherwise<U>(errback: PromiseErrback<U>): DojoPromise<U>;
trace(): this;
traceRejected(): this;
toString(): string;
}
interface DojoPromiseConstructor {
/**
* The public interface to a deferred.
*/
new <T>(): DojoPromise<T>;
}
}
type DojoPromise<T> = DojoPromise.DojoPromise<T>;
declare const DojoPromise: DojoPromise.DojoPromiseConstructor;
export = DojoPromise;