superchats
Version:
SuperChats is a premium library with unique features that control Whatsapp functions. With Superchats you can build service bots, multiservice chats or any system that uses whatsapp
35 lines (34 loc) • 1.43 kB
TypeScript
import { OrkestralEventEmitter, OrkestralEventMap } from '../../Models';
/**
* A map that contains a list of all events that have been triggered
*
* Note, this can contain different type of events
* this can make processing events extremely efficient -- since everything
* can be done in a single transaction
*/
type OrkestralEventData = Partial<OrkestralEventMap>;
type OrkestralBufferableEventEmitter = OrkestralEventEmitter & {
/** Use to process events in a batch */
process(handler: (events: OrkestralEventData) => void | Promise<void>): (() => void);
/**
* starts buffering events, call flush() to release them
* */
buffer(): void;
/** buffers all events till the promise completes */
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
/**
* flushes all buffered events
* @param force if true, will flush all data regardless of any pending buffers
* @returns returns true if the flush actually happened, otherwise false
*/
flush(force?: boolean): boolean;
/** is there an ongoing buffer */
isBuffering(): boolean;
};
/**
* The event buffer logically consolidates different events into a single event
* making the data processing more efficient.
* @param ev the orkestral event emitter
*/
export declare const makeEventBuffer: (logger: any) => OrkestralBufferableEventEmitter;
export {};