import { EventHandler } from "../../Core/EventHandler";
/**
 * Types which implement ISuspendable can have updates suspended/resumed. Useful for batch operations.
 */
export interface ISuspendable {
    /**
     * Gets a value indicating whether updates for the target are currently suspended
     */
    readonly isSuspended: boolean;
    /**
     * Suspends updates on the target
     */
    suspendUpdates(): void;
    /**
     * Resumes updates on the target
     */
    resumeUpdates(): void;
}
/**
 * Defines the interface to an {@link UpdateSuspender}, a class which allows nested suspend/resume operations on an {@link ISuspendable} target
 */
export interface IUpdateSuspender {
    /**
     * Gets a value indicating whether updates for the target are currently suspended
     */
    readonly isSuspended: boolean;
    /**
     * An {@link EventHandler} that fires an event when the suspender is becomes unsuspended
     */
    onResumed: EventHandler<void>;
    /**
     * Call to suspend updates on the target.
     * Increments call counter.
     */
    suspend(): void;
    /**
     * Call to resume updates on the target. Note this MUST be called or your target will stay suspended forever!
     *
     * @remarks to resume call this the same number of times as  { @link IUpdateSuspender.suspend },
     * or call with `force` flag to ignore multiple `suspend` executions
     */
    resume(force: boolean): void;
    /**
     *
     * @experimental Call this to force suspend drawing.
     * @returns an unlock token.
     * @remarks All of the unlock tokens have to be called to resume drawing.
     */
    lock(): () => boolean;
}
/**
 * A class which allows nested suspend/resume operations on an {@link ISuspendable} target
 */
export declare class UpdateSuspender implements IUpdateSuspender {
    onResumed: EventHandler<void>;
    protected suspendCounter: number;
    protected locks: Set<() => boolean>;
    /**
     * Gets whether the current instance is suspended
     */
    get isSuspended(): boolean;
    /**
     * Call this to suspend drawing
     */
    suspend(): void;
    /**
     * Call this to resume drawing
     */
    resume(force?: boolean): void;
    /**
     * Call this to force suspend drawing.
     * Return unlock token.
     * All of the unlock tokens are required to be called to resume drawing.
     */
    lock(): () => boolean;
}
