Skip to main content

Function: useWorker()

useWorker<T>(worker): T

Gets a shared instance of the ref-counted worker proxy.

The worker instance will be created on the first call and disposed when the last component using the hook is unmounted.

See @reactodia/worker-proxy for more information on working with transparent Web Worker proxies.

Type Parameters

Type Parameter

T

Parameters

ParameterType

worker

RefCountedWorker<T>

Returns

T

See

Defined in

coreUtils/workers.ts:16