-
Notifications
You must be signed in to change notification settings - Fork 1
Events
dysolix edited this page Apr 8, 2024
·
4 revisions
The addLCUEventListener
method allows you to add a listener for LCU events. You can subscribe to events based on various criteria like event path, types, or name. If you subscribe to a path without an event name, then Hasagi subscribes to OnJsonApiEvent.
public addLCUEventListener<EventName extends keyof LCUWebSocketEvents = "OnJsonApiEvent">(listener: LCUEventListener): void
-
listener
: An object specifying the criteria for filtering events and defining the callback function.-
path
(optional): A string or regular expression representing the event's path. If provided, the callback will only be invoked for events with matching paths. -
types
(optional): An array of event types ("Create", "Update", "Delete"). If provided, the callback will only be invoked for events of these types. -
name
(optional): The name of the event. If provided, the callback will only be invoked for events with matching names. -
callback
: The function to be called when an event matching the specified criteria occurs.
-
The removeLCUEventListener
method removes a previously added listener for LCU events. It identifies the listener to remove based on the provided parameters such as the callback function, event name, event path, or the entire listener object.
public removeLCUEventListener(listener: LCUEventListener | LCUEventListener["callback"] | string): boolean
-
listener
: The listener to remove, which can be:- The entire
LCUEventListener
object. - The callback function.
- The event name.
- The event path.
- The entire
-
true
: If the listener was found and successfully removed. -
false
: If the listener was not found.