pub fn use_worker_bridge<'hook, T, F>(
    on_output: F
) -> impl 'hook + Hook<Output = UseWorkerBridgeHandle<T>>where
    T: Worker + 'static + 'hook,
    F: Fn(T::Output) + 'static + 'hook,
Expand description

A hook to bridge to a Worker.

This hooks will only bridge the worker once over the entire component lifecycle.

Takes a callback as the argument.

The callback will be updated on every render to make sure captured values (if any) are up to date.

Note

When used in function components and hooks, this hook is equivalent to:

pub fn use_worker_bridge<T, F>(on_output: F) -> UseWorkerBridgeHandle<T>
where
    T: Worker + 'static,
    F: Fn(T::Output) + 'static,
{
    /* implementation omitted */
}