/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * [[include:core/async/README.md]] * @packageDocumentation * @module async */ import type { CallbackFunction, IAsync, IAsyncParams, ITimeout, Nullable, RejectablePromise } from "../../types/index"; type Callback = (...args: any[]) => void; export declare class Async implements IAsync { private timers; private __callbacks; delay(timeout: number | IAsyncParams): RejectablePromise; setTimeout(callback: Callback, timeout: number | IAsyncParams | undefined, ...args: any[]): number; updateTimeout(label: string, timeout: number): Nullable; private clearLabel; clearTimeout(timer: number): void; clearTimeout(label: string): void; /** * Debouncing enforces that a function not be called again until a certain amount of time has passed without * it being called. As in "execute this function only if 100 milliseconds have passed without it being called." * * @example * ```javascript * var jodit = Jodit.make('.editor'); * jodit.e.on('mousemove', jodit.async.debounce(() => { * // Do expensive things * }, 100)); * ``` */ debounce(fn: CallbackFunction, timeout: ITimeout | IAsyncParams, firstCallImmediately?: boolean): CallbackFunction; private __queueMicrotaskNative; microDebounce(fn: T, firstCallImmediately?: boolean): T; /** * Throttling enforces a maximum number of times a function can be called over time. * As in "execute this function at most once every 100 milliseconds." * * @example * ```javascript * var jodit = Jodit.make('.editor'); * jodit.e.on(document.body, 'scroll', jodit.async.throttle(function() { * // Do expensive things * }, 100)); * ``` */ throttle(fn: CallbackFunction, timeout: ITimeout | IAsyncParams, ignore?: boolean): CallbackFunction; private promisesRejections; promise(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): RejectablePromise; /** * Get Promise status */ promiseState(p: Promise): Promise<'pending' | 'fulfilled' | 'rejected'>; private __requestsIdle; private __controllers; private __requestsRaf; private __requestIdleCallbackNative; private __cancelIdleCallbackNative; requestIdleCallback(callback: IdleRequestCallback, options?: { timeout: number; }): number; requestIdlePromise(options?: { timeout: number; }): RejectablePromise; /** * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/ */ schedulerPostTask(task: () => T, options?: { signal?: AbortSignal; delay?: number; priority?: 'background' | 'user-blocking' | 'user-visible'; }): Promise; schedulerYield(): Promise; cancelIdleCallback(request: number): void; requestAnimationFrame(callback: FrameRequestCallback): number; cancelAnimationFrame(request: number): void; clear(): void; isDestructed: boolean; destruct(): any; } export {};