valia
Version:
A runtime data validator in TypeScript with advanced type inference, built-in validation functions, and seamless integration for server and client environments.
8 lines (7 loc) • 369 B
TypeScript
import type { Events } from "./types";
export declare function eventsManager(): {
listeners: Map<keyof Events, ((...args: any[]) => any)[]>;
on<K extends keyof Events>(event: K, callback: Events[K]): void;
emit<K extends keyof Events>(event: K, ...args: Parameters<Events[K]>): void;
off<K extends keyof Events>(event: K, callback: Events[K]): void;
};