import { BackendEvent, BackendEventType } from "./BackendEvent";
/**
 * Queue to limit the amount of messages sent between threads
 * This prevents communication issues which arise either in Comlink
 * or in the WebWorker message passing code
 */
export declare class BackendEventQueue {
    /**
     * Function to process events in the queue
     */
    private callback;
    /**
     * The time in milliseconds before sending events through
     */
    private flushTime;
    /**
     * Queue storing the BackendEvents before flushing
     */
    private queue;
    /**
     * Time in milliseconds when the last flush occurred
     */
    private lastFlushTime;
    /**
     * Decoder to convert data to strings
     */
    private decoder;
    /**
     * @param {function(BackendEvent):void} callback Function to process events in the queue
     * @param {number} flushTime The time in milliseconds before sending events through
     */
    constructor(callback: (e: BackendEvent) => void, flushTime?: number);
    /**
     * Add an element to the queue
     * @param {BackendEventType} type The type of the event
     * @param {string | BufferSource | number} text The data for the event
     * @param {string | any} extra Extra data for the event
     * If string, interpreted as the contentType
     * If anything else, it should contain a contentType
     * If the contentType is not textual, an error is thrown
     */
    put(type: BackendEventType, text: string | BufferSource | number, extra: string | any): void;
    /**
     * @return {boolean} Whether the queue contents should be flushed
     */
    protected shouldFlush(): boolean;
    /**
     * Reset the queue contents for a new run
     */
    reset(): void;
    /**
     * Flush the queue contents using the callback
     */
    flush(): void;
    /**
     * @param {Function} callback The event-consuming callback
     */
    setCallback(callback: (e: BackendEvent) => void): void;
}
