-
Notifications
You must be signed in to change notification settings - Fork 146
Emitter
SinisterRectus edited this page Nov 6, 2016
·
13 revisions
Modified version of Luvit's built-in event emitter. Automatically wraps event callbacks with coroutines.
Prototype | Description |
---|---|
emit(name[, ...]) | Emits a named event with an optional variable amount of arguments. |
getListenerCount(name) | Returns the number of listeners that are registered to a named event. |
getListeners(name) | Returns a iterator for the listeners registered to a named event. |
on(name, listener) | Registers a listener function that is called every time a named event is emitted. |
once(name, listener) | Registers a listener function that is called once and unregistered when a named event is emitted. |
propagate(name, target) | Causes all named event emissions to propagates to another target emitter. |
removeAllListeners(name) | Unregisters all listeners from a named event. |
removeListener(name, listener) | Unregisters a listener from a named event. |