Event Functions
There are four functions that can be used to handle event listening
Name | Description | Parameters |
---|---|---|
on | Adds an event listener | - event: Indicate the type of event to add the listener - fn: The function that will listen for events |
once | Adds an event listener that will only be triggered once | - event: Indicate the type of event to add the listener - fn: The function that will listen for events |
off | Removes an event listener | - event: Indicate the type of event you want to remove a listener from - fn: The listener to be removed |
removeAllListeners | Removes all event listeners | - event: Indicates the type of event for which you want to remove all listeners. If you ignore this parameter, the function will remove all listeners on all event types |