@lazarv/react-server/worker
Helpers for modules marked with the "use worker" directive. On the server runs in a Node Worker Thread; on the client runs in a Web Worker.
function isWorker(): boolean;
Returns true when the calling code is executing inside a worker spawned
by a "use worker" module.
- Server — checks whether the current Node.js thread is a
framework-managed Worker Thread. Returns
falsein Edge builds where"use worker"functions run in-process. - Client — checks whether the current context is a Web Worker.
Works identically in both server-side and client-side "use worker" modules.
Import from @lazarv/react-server/worker — this sub-path has no
server-only dependencies and is safe to use in Web Workers.
Returns — true if inside a "use worker" worker, false otherwise.