FluentUI Compat

Home > @cascadiacollections/fluentui-compat > EventGroup > on

EventGroup.on() method

Adds an event listener to the specified target.

This method registers an event listener and tracks it for automatic cleanup. Multiple listeners can be added to the same target/event combination.

Signature:

on(target: IEventTarget, eventName: string, callback: EventListener | ((...args: any[]) => void), options?: EventListenerOptions): EventGroup;

Parameters

Parameter

Type

Description

target

IEventTarget

The event target (element, window, document, etc.)

eventName

string

The name of the event to listen for

callback

EventListener | ((...args: any[]) => void)

The callback function to invoke when the event fires

options

EventListenerOptions

(Optional) Optional event listener options (capture, passive, once, etc.)

Returns:

EventGroup

This EventGroup instance for method chaining

  • Edit this page
In this article
Back to top FluentUI React complimentary components and utilities focused on render performance