Skip to content

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.

MDN Reference

EventMap extends Record<string, Event> = Record<string, Event>

new EventTarget<EventMap>(): EventTarget<EventMap>

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:872

EventTarget<EventMap>

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.

MDN Reference

Type extends string | number | symbol

Type

EventListenerOrEventListenerObject<EventMap[Type]>

boolean | EventTargetAddEventListenerOptions

void


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.

MDN Reference

EventMap[keyof EventMap]

boolean


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.

MDN Reference

Type extends string | number | symbol

Type

EventListenerOrEventListenerObject<EventMap[Type]>

boolean | EventTargetEventListenerOptions

void