chrobot_extra/network_idle

Network idle detection for chrobot_extra. Tracks active network requests and waits until no requests are in-flight for a specified quiet period, similar to Playwright’s networkidle.

Types

Active network idle listener handle

pub opaque type IdleListener

Values

pub fn defer_stop(listener: IdleListener, body: fn() -> a) -> a

Defer pattern for use expressions.

pub fn start(
  page: chrobot_extra.Page,
) -> Result(IdleListener, chrome.RequestError)

Start tracking network activity on the given page. Enables the Network domain and subscribes to request start/finish/fail events.

pub fn stop(listener: IdleListener) -> Nil

Remove all event listeners.

pub fn wait_for_idle(
  listener: IdleListener,
  quiet_ms quiet_ms: Int,
  time_out timeout: Int,
) -> Result(Nil, chrome.RequestError)

Wait until no network requests are in-flight for quiet_ms milliseconds. Returns Error(ChromeAgentTimeout) if the total time_out is exceeded.

Search Document