Skip to content

Commit

Permalink
Add Event Types
Browse files Browse the repository at this point in the history
This makes addEventListener on GPUDevice have the right type
information.
  • Loading branch information
greggman committed Jan 31, 2025
1 parent 8faeb6d commit 69d91fc
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,10 @@ declare var GPUComputePipeline: {
new (): never;
};

interface GPUDeviceEventMap {
uncapturederror: GPUUncapturedErrorEvent;
}

interface GPUDevice
extends EventTarget,
GPUObjectBase {
Expand Down Expand Up @@ -2631,6 +2635,45 @@ interface GPUDevice
ev: GPUUncapturedErrorEvent
) => any)
| null;

addEventListener<
K extends keyof GPUDeviceEventMap
>(
type: K,
listener: (
this: GPUDevice,
ev: GPUDeviceEventMap[K]
) => any,
options?:
| boolean
| AddEventListenerOptions
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?:
| boolean
| AddEventListenerOptions
): void;
removeEventListener<
K extends keyof GPUDeviceEventMap
>(
type: K,
listener: (
this: GPUDevice,
ev: GPUDeviceEventMap[K]
) => any,
options?:
| boolean
| EventListenerOptions
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?:
| boolean
| EventListenerOptions
): void;
}

declare var GPUDevice: {
Expand Down

0 comments on commit 69d91fc

Please sign in to comment.