Namespace: state

syngen.state

Provides a helper for importing and exporting state. Systems can subscribe to its events to persist and load their inner states.

Implements:
Source:

Methods

(static) export() → {Object}

Exports the state. The inverse of syngen.state.import.

Source:
Fires:
Returns:
Type
Object

(static) import(stateopt)

Imports the state. The inverse of syngen.state.export.

Parameters:
Name Type Attributes Description
state Object <optional>
Source:
Fires:

(static) reset()

Resets to a blank state.

Source:
Fires:

Events

event:export

Fired when state is exported. Subscribers should add an entry to the passed object with their exported state.

Type:
  • Object
Source:
Listeners of This Event:

event:import

Fired when state is imported. Subscribers should consume the entry they added during export, if one exists.

Type:
  • Object
Source:
Listeners of This Event:

event:reset

Fired when state is reset. Subscribers should clear their internal state when fired.

Source:
Listeners of This Event: