Skip to content

Commit 9902468

Browse files
committed
Fix EventTarget.addEventListener and EventTarget.removeEventListener
1 parent c882947 commit 9902468

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

baselines/dom.generated.d.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -3701,9 +3701,9 @@ declare var Event: {
37013701
}
37023702

37033703
interface EventTarget {
3704-
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
3704+
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | AddEventListenerOptions): void;
37053705
dispatchEvent(evt: Event): boolean;
3706-
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
3706+
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void;
37073707
}
37083708

37093709
declare var EventTarget: {
@@ -14172,6 +14172,15 @@ interface PromiseRejectionEventInit extends EventInit {
1417214172
reason?: any;
1417314173
}
1417414174

14175+
interface EventListenerOptions {
14176+
capture: boolean;
14177+
}
14178+
14179+
interface AddEventListenerOptions extends EventListenerOptions {
14180+
passive: boolean;
14181+
once: boolean;
14182+
}
14183+
1417514184
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
1417614185

1417714186
interface ErrorEventHandler {
@@ -14871,7 +14880,7 @@ declare function scrollTo(options?: ScrollToOptions): void;
1487114880
declare function scrollBy(options?: ScrollToOptions): void;
1487214881
declare function toString(): string;
1487314882
declare function dispatchEvent(evt: Event): boolean;
14874-
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
14883+
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void;
1487514884
declare function clearInterval(handle: number): void;
1487614885
declare function clearTimeout(handle: number): void;
1487714886
declare function setInterval(handler: (...args: any[]) => void, timeout: number): number;

baselines/webworker.generated.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ declare var Event: {
399399
}
400400

401401
interface EventTarget {
402-
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
402+
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | AddEventListenerOptions): void;
403403
dispatchEvent(evt: Event): boolean;
404-
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
404+
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void;
405405
}
406406

407407
declare var EventTarget: {
@@ -1717,7 +1717,7 @@ declare function msWriteProfilerMark(profilerMarkName: string): void;
17171717
declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise<ImageBitmap>;
17181718
declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
17191719
declare function dispatchEvent(evt: Event): boolean;
1720-
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
1720+
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void;
17211721
declare var indexedDB: IDBFactory;
17221722
declare var msIndexedDB: IDBFactory;
17231723
declare var navigator: WorkerNavigator;
@@ -1736,7 +1736,7 @@ declare function btoa(rawString: string): string;
17361736
declare var console: Console;
17371737
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
17381738
declare function dispatchEvent(evt: Event): boolean;
1739-
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
1739+
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void;
17401740
declare function addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
17411741
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
17421742
type AlgorithmIdentifier = string | Algorithm;

inputfiles/addedTypes.json

+22
Original file line numberDiff line numberDiff line change
@@ -1534,5 +1534,27 @@
15341534
"name": "getElementById",
15351535
"flavor": "DOM",
15361536
"signatures": ["getElementById(elementId: string): HTMLElement | null"]
1537+
},
1538+
{
1539+
"kind": "interface",
1540+
"name": "EventListenerOptions",
1541+
"flavor": "Web",
1542+
"properties": [{
1543+
"name": "capture",
1544+
"type": "boolean"
1545+
}]
1546+
},
1547+
{
1548+
"kind": "interface",
1549+
"name": "AddEventListenerOptions",
1550+
"extends": "EventListenerOptions",
1551+
"flavor": "Web",
1552+
"properties": [{
1553+
"name": "passive",
1554+
"type": "boolean"
1555+
}, {
1556+
"name": "once",
1557+
"type": "boolean"
1558+
}]
15371559
}
15381560
]

inputfiles/overridingTypes.json

+12
Original file line numberDiff line numberDiff line change
@@ -1016,5 +1016,17 @@
10161016
"interface": "DOMImplementation",
10171017
"name": "createDocument",
10181018
"signatures": ["createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document"]
1019+
},
1020+
{
1021+
"kind": "method",
1022+
"interface": "EventTarget",
1023+
"name": "addEventListener",
1024+
"signatures": ["addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | AddEventListenerOptions): void"]
1025+
},
1026+
{
1027+
"kind": "method",
1028+
"interface": "EventTarget",
1029+
"name": "removeEventListener",
1030+
"signatures": ["removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean | EventListenerOptions): void"]
10191031
}
10201032
]

0 commit comments

Comments
 (0)