Skip to content

Commit

Permalink
Add a few EventTarget related types / interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Oct 21, 2023
1 parent 99ccc71 commit a3b7ab6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-badgers-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nxjs-runtime': patch
---

Add a few `EventTarget` related types / interfaces
24 changes: 24 additions & 0 deletions packages/runtime/src/polyfills/event-target.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
import { def } from '../utils';
import ET from '@ungap/event-target';
import type { Event } from './event';
import type { AbortSignal } from './abort-controller';
def('EventTarget', ET);

export interface EventListener {
(evt: Event): void;
}

export interface EventListenerObject {
handleEvent(object: Event): void;
}

export type EventListenerOrEventListenerObject =
| EventListener
| EventListenerObject;

export interface EventListenerOptions {
capture?: boolean;
}

export interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
signal?: AbortSignal;
}

/**
* EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
*
Expand Down

0 comments on commit a3b7ab6

Please sign in to comment.