Grape.System Class
A system can be added to a layer, and the layer emits all of its event to the system. The system can access the layer through the getLayer method.
Constructor
Grape.System
()
Methods
emit
(
-
event
-
payload
Emits an event to the instance: calls all event listeners subscribed to this event, or the 'any' event.
Parameters:
-
event
StringEvent
-
payload
An object passed as parameter to all event listeners.
getLayer
()
Grape.Layer | Undefined
Returns the layer the system is added to.
Returns:
Grape.Layer | Undefined:
The layer
off
(
-
event
-
listener
Unsubscribes from an event.
Parameters:
-
event
StringEvent
-
listener
FunctionEvent listener
on
(
-
event
-
listener
Subscribes to an event. The event handler will be called with this instance as context.
Parameters:
-
event
StringThe event to subscribe
-
listener
FunctionEvent listener
Events
any
Emitted when any event is emitted. The parameters are the event and the payload.