What is the EventTarget class in Deno?

What is Deno?

It is a small, general-purpose runtime environment for JavaScript with first-class support for various interfaces, ECMAScript modules, and seamless TypeScript integration.

Class EventTarget

Class EventTarget is a DOM interface implemented by objects that can receive events and may also have listeners for incoming objects.

Properties

[Symbol.toStringTag]: string

Methods

addEventListener

addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void

This method listens to a type of value (string in most cases) using the listener method. After the event is dispatched, this class calls the callback function. The options argument defines the listener options. The datatype is used in boolean. The event listener is appended to target’s event listener list and is not appended if it has the same type, callback, and capture.

dispatchEvent

dispatchEvent(event: Event): boolean

This method is used to dispatch any synthetic event to target. It returns true if its cancelable attribute value is false or if its preventDefault() method was not invoked.

removeEventListener

removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void

Removes the event listener from the list of the target event listener with the same type, callback, and options.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved