import DojoPromise = require("../promise/Promise"); import { PromiseCallback, PromiseErrback, PromiseProgback } from "../promise/Promise"; import declare = require("./declare"); /* dojo/_base/Deferred */ interface Deferred { promise: DojoPromise; /** * 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; /** * Resolve the deferred. */ resolve(value?: T, strict?: boolean): DojoPromise; /** * Reject the deferred. */ reject(error?: any, strict?: boolean): DojoPromise; /** * The results of the Deferred */ results: [T, any]; /** * Adds callback and error callback for this deferred instance. */ addCallbacks(callback?: PromiseCallback, errback?: PromiseErrback): Deferred; /** * Add new callbacks to the deferred. */ then(callback?: PromiseCallback, errback?: PromiseErrback, progback?: PromiseProgback): DojoPromise; /** * Cancels the asynchronous operation */ cancel(): void; /** * Adds successful callback for this deferred instance. */ addCallback(callback: PromiseCallback): Deferred; /** * Adds error callback for this deferred instance. */ addErrback(errback: PromiseErrback): Deferred; /** * Add handler as both successful callback and error callback for this deferred instance. */ addBoth(callback?: PromiseErrback): Deferred; fired: number; } interface DeferredConstructor { /** * Deprecated. This module defines the legacy dojo/_base/Deferred API. * New code should use dojo/Deferred instead. */ new (canceller?: (reason: any) => void): Deferred; prototype: Deferred; /** * Transparently applies callbacks to values and/or promises. */ when(valueOrPromise: any): Deferred; when(valueOrPromise: any, callback?: PromiseCallback, errback?: PromiseErrback, progback?: PromiseProgback): Deferred; } declare const Deferred: DeferredConstructor; export = Deferred;