UNPKG

@infectedbyjs/emitts

Version:

A type-safe event emitter for TypeScript with priority-based listeners, sequential/parallel execution strategies, and memory leak detection

30 lines (29 loc) 1.01 kB
import type { EventMap } from "./types"; /** * Inserts an item into an array in descending order based on a numeric key. * * @template T * @param array The array to insert into * @param item The item to insert * @param getKey A function to get the sorting key */ export declare function insertSorted<T>(array: T[], item: T, getKey: (item: T) => number): void; /** * Removes the first item from the array that matches the predicate. * * @template T * @param array The array to remove from * @param match Predicate function to find the item */ export declare function removeFromArray<T>(array: T[], match: (item: T) => boolean): void; type LogParams<Events extends EventMap> = { event?: keyof Events; data?: unknown; message?: string; }; /** * Default debug logger used when debug mode is enabled. * Provides detailed information about internal events and operations. */ export declare function log<Events extends EventMap>(operation: string, params: LogParams<Events>): void; export {};