devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
68 lines (62 loc) • 4 kB
TypeScript
/**
* DevExtreme (core/utils/deferred.d.ts)
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
interface Callback<T> {
// eslint-disable-next-line @typescript-eslint/prefer-function-type
(value: T, ...args: T[]): void;
}
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export class DeferredObj<T> {
constructor();
state(): 'pending' | 'rejected' | 'resolved';
always(alwaysCallback?: Callback<T>): DeferredObj<T>;
catch(catchCallback?: Callback<T>): DeferredObj<T>;
then(resolveCallback?: Callback<T>, rejectCallback?: Callback<T>): DeferredObj<T>;
done(doneCallback?: Callback<T>): DeferredObj<T>;
fail(failCallback?: Callback<T>): DeferredObj<T>;
progress(progressCallback?: Callback<T>): DeferredObj<T>;
notify(...args: T[]): DeferredObj<T>;
notifyWith(context: DeferredObj<T>, args?: T[]): DeferredObj<T>;
reject(...args: T[]): DeferredObj<T>;
rejectWith(context: DeferredObj<T>, args?: T[]): DeferredObj<T>;
resolve(...args: T[]): DeferredObj<T>;
resolveWith(context: DeferredObj<T>, args?: T[]): DeferredObj<T>;
promise(target?: T): Promise<T>;
}
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export function Deferred<T>(): DeferredObj<T>;
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export interface PromiseType<T> { }
/**
*
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export type DxPromise<T = void> = {} extends PromiseType<T> ? Promise<T> : PromiseType<T>;
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export type DxExtendedPromise<T> = DxPromise<T> & {
then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T, extraParameters?: any) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
): PromiseLike<TResult1 | TResult2>;
};
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export function when<T>(...args: (DeferredObj<T> | T)[]): DeferredObj<T>;