UNPKG

967 BTypeScriptView Raw
1/**
2 * The current implementation was chosen by performance and compatibility reasons, feel free to play
3 * with benchmarks and submit PR with faster alternative. Each method contains links to benchmarks.
4 */
5import { EventListeners } from '../types';
6export default class EventSet {
7 private readonly handlers;
8 /**
9 * @see https://jsperf.com/suir-eventset-constructor
10 */
11 constructor(eventHandlers: EventListeners);
12 /**
13 * @see https://jsperf.com/suir-eventset-addhandlers
14 */
15 addHandlers(additionalHandlers: EventListeners): EventSet;
16 /**
17 * @see https://jsperf.com/suir-eventset-dispatchsingle
18 * @see https://jsperf.com/suir-eventset-dispatchmultiple2
19 */
20 dispatchEvent(event: Event, dispatchAll: boolean): void;
21 hasHandlers(): boolean;
22 /**
23 * @see https://jsperf.com/suir-eventset-removehandlers
24 */
25 removeHandlers(removalHandlers: EventListeners): EventSet;
26}