Module event
Event library, similar to the one found in OpenOS.
Functions
pullFiltered ([seconds], filter) | Gets an event that satisfies filter or a filter and a timeout in seconds. |
flush () | Flush all pending events, that is all pending events of the current process are immediately discarded. |
pull ([seconds], filter) | Gets an event for which the name satisfies the given match or the timeout is elapsed. |
listen (name, callback) | Setup a callback to be called when an event with the given name is received. |
cancel (timerId) | Cancels a listener using its timer ID. |
ignore (name, callback) | Cancels one listener waiting for the given event and using the given callback |
Functions
- pullFiltered ([seconds], filter)
-
Gets an event that satisfies filter or a filter and a timeout in seconds.
Parameters:
- seconds number Time in seconds until the function returns if no event was found (optional)
- filter optional function The filter to use to filter out events
- flush ()
- Flush all pending events, that is all pending events of the current process are immediately discarded.
- pull ([seconds], filter)
-
Gets an event for which the name satisfies the given match or the timeout is elapsed.
Parameters:
- seconds number Time in seconds until the function returns if no event was found (optional)
- filter optional string The match for the event name
- listen (name, callback)
-
Setup a callback to be called when an event with the given name is received.
Parameters:
- name string The name of the event
- callback function The function to be called when that event is received
Returns:
-
int
The timer ID
- cancel (timerId)
-
Cancels a listener using its timer ID.
Parameters:
- timerId int The timer ID
Returns:
-
bool
Returns true if there was a listener with the given timer iD
See also:
- ignore (name, callback)
-
Cancels one listener waiting for the given event and using the given callback
Parameters:
- name string The name of the event
- callback function The callback funciton
Returns:
-
bool
Returns true if a listener matching the criterias was cancelled
See also: