cockpit-plugin-base-react - v1.1.1
    Preparing search index...

    Function useAsyncStream

    • Accumulates line-buffered output from a Cockpit process into a lines array.

      The caller supplies a startProcess factory that receives a launch callback. Call launch(proc) synchronously once the process is ready — this avoids the JS Promise "following" behaviour that occurs when a CockpitProcess (which extends Promise) is returned from inside a .then().

      The deps array works like useEffect deps — the hook tears down and restarts the process whenever any dep changes.

      Parameters

      • startProcess: (launch: (proc: CockpitProcess) => void) => Promise<void>

        Factory that receives a launch callback and must call it with the process.

      • deps: any[]

        Re-run dependencies (same semantics as useEffect).

      Returns AsyncStreamResult