Usage
Typescript Import Format
//To import this class, use the format below.
import {EventSource} from "ojs/ojcore-base";
For additional information visit:
Final classes in JET
Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.
Constructor
new EventSource
Methods
-
handleEvent(eventType, event) : {boolean}
-
Handle the event
Parameters:
Name Type Description eventTypestring event type eventObject event Returns:
Returns false if event is cancelled
- Type
- boolean
-
Init
-
Initializes the instance.
-
off(eventType, eventHandler) : {void}
-
Detach an event handler.
Application can call this if it no longer wants to be notified of an event that it has attached an handler to using the
onmethod.Parameters:
Name Type Description eventTypestring eventType eventHandlerfunction(Object) event handler function Returns:
- Type
- void
-
on(eventType, eventHandler) : {void}
-
Attach an event handler.
Application can call this if it wants to be notified of an event. It can call the
offmethod to detach the handler when it no longer wants to be notified.Parameters:
Name Type Description eventTypestring eventType eventHandlerfunction(Object) event handler function Returns:
- Type
- void