@prezly/react-promise-modal
Version:
The proper (and easy) way of doing modals in React. With Promises.
15 lines (14 loc) • 483 B
TypeScript
/**
* This kinda follows the Jquery.Deferred type idea.
* @see https://api.jquery.com/jQuery.Deferred/
*
* Deferred is mostly a promise, but you can resolve or reject it from outside.
* This 'Deferred' here is a much more limited version of the JQuery Deferred.
*/
export type Deferred<T> = {
promise: Promise<T>;
resolve: (value: T) => void;
reject: (reason: unknown) => void;
isSettled(): boolean;
};
export declare function createDeferred<T>(): Deferred<T>;