nvim_runtime_lua

uv.uv_idle_t

uv_idle_t - Idle handle

[uv_handle_t][] functions also apply.

Idle handles will run the given callback once per loop iteration, right before the [uv_prepare_t][] handles.

Note: The notable difference with prepare handles is that when there are active idle handles, the loop will perform a zero timeout poll instead of blocking for I/O.

Warning: Despite the name, idle handles will get their callbacks called on every loop iteration, not when the loop is actually "idle".

local idle = uv.new_idle()
idle:start(function()
  print("Before I/O polling, no blocking")
end)

Methods2

function uv_idle_t.start(callback: fun() -> nil) -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Start the handle with the given callback.

function uv_idle_t.stop() -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Stop the handle, the callback will no longer be called.