Module signal
Signal management.
No dependency.
Module
| new () | Creates and return a new SignalRegistry. |
| event | SignalRegistry which will be used to bind signals that need to be called on game engine event; other ubiquitousse modules may bind to this registry if avaible. |
| registerEvents () | Call this function to hook signal.event signals to LÖVE events. |
SignalRegistry objects
| SignalRegistry.signals | Map of signals to list of listeners. |
| SignalRegistry:bind (name, fn, ...) | Bind one or several functions to a signal name. |
| SignalRegistry:unbind (name, fn, ...) | Unbind one or several functions to a signal name. |
| SignalRegistry:unbindAll (name) | Remove every bound function to a signal name. |
| SignalRegistry:replace (name, sourceFn, destFn) | Replace a bound function with another function. |
| SignalRegistry:clear () | Remove every bound function to every signal. |
| SignalRegistry:emit (name, ...) | Emit a signal, i.e. |
Module
- new ()
-
Creates and return a new SignalRegistry.
Returns:
- event
-
SignalRegistry which will be used to bind signals that need to be called on game engine event; other ubiquitousse modules may bind to this registry if avaible.
For example, every ubiquitousse module with a “update” function will bind it to the “update” signal in the registry; you can then call this signal on each game update to update every ubiquitousse module easily.
Provided signals:
update(dt), should be called on every game updatedraw(), should be called on every game draw- for LÖVE, there are callbacks for every LÖVE callback function that need to be called on their corresponding LÖVE callback
- registerEvents ()
-
Call this function to hook signal.event signals to LÖVE events.
This means overriding every existing LÖVE callback. If a callback is already defined, the new one will call the old function along with the signal:emit.
Requires:
-
love
SignalRegistry objects
Signal registry.
A SignalRegistry is a separate ubiquitousse.signal instance: its signals will be independant from other registries.
- SignalRegistry.signals
- Map of signals to list of listeners.
- SignalRegistry:bind (name, fn, ...)
-
Bind one or several functions to a signal name.
Parameters:
- name
- fn
- ...
- SignalRegistry:unbind (name, fn, ...)
-
Unbind one or several functions to a signal name.
Parameters:
- name
- fn
- ...
- SignalRegistry:unbindAll (name)
-
Remove every bound function to a signal name.
Parameters:
- name
- SignalRegistry:replace (name, sourceFn, destFn)
-
Replace a bound function with another function.
Parameters:
- name
- sourceFn
- destFn
- SignalRegistry:clear ()
- Remove every bound function to every signal.
- SignalRegistry:emit (name, ...)
-
Emit a signal, i.e. call every function bound to it, with the given arguments.
Parameters:
- name
- ...