Events

Class EventTarget

Base class for event management.

constructor (): EventTarget

Property .events : Map<string, Array<EventCallback>>

Default value: ...

Method .off (events: string, fn: EventCallback): void

Removes an event listener from one or more events.

Name Type Default Description
events string    
fn EventCallback    

Method .on (events: string, fn: EventCallback): void

Adds an event listener for one or more events.

Name Type Default Description
events string    
fn EventCallback    

Method .one (events: string, fn: EventCallback): void

Adds a one-time event listener to one or more events.

Name Type Default Description
events string    
fn EventCallback    

Method .trigger (events: string, arg: unknown): void

Triggers one or more events, and executes all bound event listeners.

Name Type Default Description
events string    
arg unknown    

Copyright © 2024 Mathigon.org