/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net */ import type { CallbackFunction, IDestructible } from './types'; export type ITimeout = number | (() => number); export interface IAsyncParams { timeout?: number; label?: string; promisify?: boolean; } export interface RejectablePromise extends Promise { rejectCallback: (reason?: any) => void; finally(onfinally?: (() => void) | undefined | null): Promise } export interface IAsync extends IDestructible { setTimeout( callback: (...args: T[]) => void, timeout: number | IAsyncParams, ...args: T[] ): number; clearTimeout(timer: number): void; clear(): void; promise( executor: ( resolve: (value: T | PromiseLike) => void, reject?: (reason?: any) => void ) => void ): RejectablePromise; promiseState( p: Promise ): Promise<'pending' | 'fulfilled' | 'rejected'>; debounce( fn: CallbackFunction, timeout: ITimeout | IAsyncParams, firstCallImmediately?: boolean ): CallbackFunction; throttle( fn: CallbackFunction, timeout: ITimeout | IAsyncParams, firstCallImmediately?: boolean ): CallbackFunction; requestIdleCallback(fn: CallbackFunction): number; requestIdlePromise(): Promise; cancelIdleCallback(request: number): void; }