@np-dev/youtubei-js
Version:
A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).
9 lines (8 loc) • 481 B
TypeScript
export interface EventEmitter<Events extends Record<string, any>> {
emit<Type extends keyof Events>(type: Type, event: Events[Type]): void;
on<Type extends keyof Events>(type: Type | "*", listener: Listener<Events[Type]>): Off;
off(type: keyof Events): void;
}
export type Listener<Event = any> = (event: Event, type: string) => void;
export type Off = () => void;
export declare function createEventEmitter<Events extends Record<string, any>>(): EventEmitter<Events>;