mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 19:17:27 -04:00
Updated API Event (markdown)
parent
4b10126153
commit
ac29a2470a
@ -1,7 +1,8 @@
|
|||||||
This API provides a rudimentary event system. It is primarily intended to be used by libraries, to allow them to be notified of signals. For example, this is used to automatically bind the primary screen to the primary GPU, to check whether the [[terminal|API/Term]] is available, and to execute autorun programs on newly installed file systems.
|
This API provides a rudimentary event system. It is primarily intended to be used by libraries, to allow them to be notified of signals. For example, this is used to automatically bind the primary screen to the primary GPU, to check whether the [[terminal|API/Term]] is available, and to execute autorun programs on newly installed file systems.
|
||||||
|
|
||||||
- `event.listen(name: string, callback: function): boolean`
|
- `event.listen(name: string, callback: function): boolean`
|
||||||
Register a new event listener that should be called for events with the specified name. When registering for signal events, this is the name of the signal. Returns `true` if the listener was successfully registered, `false` if it already was registered for this event type.
|
Register a new event listener that should be called for events with the specified name. When registering for signal events, this is the name of the signal. Returns `true` if the listener was successfully registered, `false` if it already was registered for this event type.
|
||||||
|
Note that event listeners may return `false` to unregister themselves (equivalent to calling `event.ignore` and passing the listener with the event name it was registered for).
|
||||||
- `event.ignore(name: string, callback: function): boolean`
|
- `event.ignore(name: string, callback: function): boolean`
|
||||||
Unregister a previously registered event listener. Returns `true` if the event listener was removed, `false` if the listener was not registered.
|
Unregister a previously registered event listener. Returns `true` if the event listener was removed, `false` if the listener was not registered.
|
||||||
- `event.timer(interval: number, callback: function[, times: number]): number`
|
- `event.timer(interval: number, callback: function[, times: number]): number`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user