UNPKG

932 BPlain TextView Raw
1export class SignatureEventTarget {
2 /* tslint:disable: variable-name */
3 private _et: EventTarget;
4 /* tslint:enable: variable-name */
5
6 constructor() {
7 try {
8 this._et = new EventTarget();
9 } catch (error) {
10 // Using document as EventTarget to support iOS 13 and older.
11 // Because EventTarget constructor just exists at iOS 14 and later.
12 this._et = document;
13 }
14 }
15
16 addEventListener(
17 type: string,
18 listener: EventListenerOrEventListenerObject | null,
19 options?: boolean | AddEventListenerOptions,
20 ): void {
21 this._et.addEventListener(type, listener, options);
22 }
23
24 dispatchEvent(event: Event): boolean {
25 return this._et.dispatchEvent(event);
26 }
27
28 removeEventListener(
29 type: string,
30 callback: EventListenerOrEventListenerObject | null,
31 options?: boolean | EventListenerOptions,
32 ): void {
33 this._et.removeEventListener(type, callback, options);
34 }
35}