API.md

@lazarv/react-server/worker

この API リファレンスはまだ翻訳されていません。以下は英語版の内容です。

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.

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.

Returnstrue if inside a "use worker" worker, false otherwise.

"use worker"; import { isWorker } from "@lazarv/react-server/worker"; export async function terminate() { if (isWorker()) { process.exit(0); } }