API Docs for: 1.0.1

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

()

Item Index

Methods

Events

Methods

emit

(
  • event
  • payload
)

Emits an event to the instance: calls all event listeners subscribed to this event, or the 'any' event.

Parameters:

  • event String

    Event

  • 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 String

    Event

  • listener Function

    Event listener

on

(
  • event
  • listener
)

Subscribes to an event. The event handler will be called with this instance as context.

Parameters:

  • event String

    The event to subscribe

  • listener Function

    Event listener

Events

any

Emitted when any event is emitted. The parameters are the event and the payload.