Lava Event Plugin for Lava | mumu@lava-event | Event Plugin
This plugin provides asynchronous time-based event functions for the Lava repl.
Supported calls:
event:timeout how, cb-- Schedules a function to run after a delay.event:interval ms, cb-- Repeatedly calls a function on a simple timer.event:loop(cb)-- Executes a function on every tick. Partial usage, _ including placeholder _, is supported in the functions.
Installation
``b make make install
```sh
# In Lava repl session:
extend("event")
event:interval(1000, () => slog("Hi"))));
This plugin can be extended with "extend("event")", "lava:event.so", or by copying the library to asynchorous core directory.
Finctions
event:timeout(ms, function) | Schedules a callback after 'ms' delay
event:interval(ms, function) // Repeats until called event:stop() terminates the interval.
event:loop(cb) | Executes 'cn' on every repl tick.
Partials (using _ placeholder) have a javascript/Ramda type feel.
event:stop(handle) | Stops the active interval or loop, where 'handle' is an integer returned by event:timeout, event:interval, or event:loop.
This plugin was tested on linux, but should work on most unix distributions.
Please see the "LICENSE" file for licensing information.
license mit/Apache-2.0 (or optional) contributor: Tom Fotheringham and contributors
https://gitlab.com/tofo/mumu-event