UNPKG

@boost/event

Version:

An event system with multiple emitter patterns.

17 lines (15 loc) 358 B
import { BaseEvent } from './BaseEvent'; export class Event<Args extends unknown[], Scope extends string = string> extends BaseEvent< void, Args, Scope > { /** * Synchronously execute listeners with the defined arguments. */ emit(args: Args, scope?: Scope) { [...this.getListeners(scope)].forEach((listener) => { listener(...args); }); } }