A structure for events fired in various parts of the toolkit.
- name (string) – the event’s name.
- data (string) – the event’s data. Optional.
Lightweight wrapper around
EventEmitter()for working better with Q promises and the toolkit’s
Emits the given event and returns a promise that will be fulfilled once each listener is done. This allows listeners to return promises.
- event (Event) – the event to emit.
Shortcut for emitting a setup event for the instance (since this is done quite often). See
Returns a promise that will be fulfilled once the event has been emitted. Since a promise can only be fulfilled once, the event listener is removed after the event is emitted. Useful for testing events.
- event_name (string) – the event to listen for.
Removes all event listeners, with the following exception: listeners for
TeardownEvent()s get rebound using
Eventable.once(), regardless of whether they were orginally bound using
Eventable.once(). This allows us to remove all event listeners for instances of
Eventable(), while still allowing other entities to know when the teardown of the entity has completed.
Not that it is up to the caller to emit the
TeardownEvent()to clear the listeners.
Emitted when an instance of something has been constructed.
- instance (object) – the constructed instance.
Emitted when an instance of something has completed the tasks it needs to complete before it can be safely disposed of.
- instance (object) – the instance.