Base interface
handle:is_active()
Returns a boolean.
handle:get_loop()
Get the associated loop. Returns nil if the loop is already released.
handle:get_type()
Get the handle type.
Returns a string defined by uv_handle_type_name.
handle:close()
Close the handle. Idempotent.
Subsequent use of the handle will throw an error.
Async
loop:async(callback)
Create an async handle.
- callback:
(async)
async:send()
Wake up the event loop and call the async handle’s callback.
Timers
loop:timer()
Create a timer handle.
timer:start(timeout, repeat_period, callback)
Start the timer.
- timeout: first timeout in seconds
- repeat_period: repeat period in seconds,
0to disable - callback:
(timer)
timer:stop()
Stop the timer.
timer:again()
Stop the timer, and if it is repeating restart it using the repeat value as the timeout.
timer:set_repeat(period)
period:: repeat period in seconds, 0 to disable
timer:get_repeat()
Get the repeat period (in seconds).
timer:get_due_in()
Get the timer due value (in seconds, 0 if expired).
Signals
loop:signal()
Create a signal handle.
signal:start(signum, callback)
Start watching for the given signal.
- signum: signal number
- callback:
(signal, signum)
signal:start_oneshot(signum, callback)
Same as start(), but the signal handler is reset the moment the signal is
received.
signal:stop()
Stop watching for signals.