EventTarget
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:869
The EventTarget interface is implemented by objects that can receive events and may have listeners for them.
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”EventMap
Section titled “EventMap”EventMap extends Record<string, Event> = Record<string, Event>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventTarget<
EventMap>():EventTarget<EventMap>
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:872
Returns
Section titled “Returns”EventTarget<EventMap>
Methods
Section titled “Methods”addEventListener()
Section titled “addEventListener()”addEventListener<
Type>(type,handler,options?):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:878
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Type Parameters
Section titled “Type Parameters”Type extends string | number | symbol
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<EventMap[Type]>
options?
Section titled “options?”boolean | EventTargetAddEventListenerOptions
Returns
Section titled “Returns”void
dispatchEvent()
Section titled “dispatchEvent()”dispatchEvent(
event):boolean
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:898
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Parameters
Section titled “Parameters”EventMap[keyof EventMap]
Returns
Section titled “Returns”boolean
removeEventListener()
Section titled “removeEventListener()”removeEventListener<
Type>(type,handler,options?):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:888
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Type Parameters
Section titled “Type Parameters”Type extends string | number | symbol
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<EventMap[Type]>
options?
Section titled “options?”boolean | EventTargetEventListenerOptions
Returns
Section titled “Returns”void