aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-08-14 12:08:29 -0700
committerGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-08-14 12:08:33 -0700
commiteab7b4c3ea3c42eb391293f4cfa7f8e01a6b43ac (patch)
treeba9cdd78c280fb1b1d63cb3d2bb14a41b4ed160f /docs
parent0329061f1552406ef1e440f01edbf054a85a615d (diff)
downloadbun-eab7b4c3ea3c42eb391293f4cfa7f8e01a6b43ac.tar.gz
bun-eab7b4c3ea3c42eb391293f4cfa7f8e01a6b43ac.tar.zst
bun-eab7b4c3ea3c42eb391293f4cfa7f8e01a6b43ac.zip
Small docs change
Diffstat (limited to 'docs')
-rw-r--r--docs/api/workers.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/api/workers.md b/docs/api/workers.md
index 73a925531..cdf6b76c5 100644
--- a/docs/api/workers.md
+++ b/docs/api/workers.md
@@ -121,7 +121,7 @@ This event does not exist in browsers.
By default, an active `Worker` will keep the main (spawning) process alive, so async tasks like `setTimeout` and promises will keep the process alive. Attaching `message` listeners will also keep the `Worker` alive.
-### `worker.unref`
+### `worker.unref()`
To stop a running worker from keeping the process alive, call `worker.unref()`. This decouples the lifetime of the worker to the lifetime of the main process, and is equivlent to what Node.js' `worker_threads` does.
@@ -132,7 +132,7 @@ worker.unref();
Note: `worker.unref()` is not available in browers.
-### `worker.ref`
+### `worker.ref()`
To keep the process alive until the `Worker` terminates, call `worker.ref()`. A ref'd worker is the default behavior, and still needs something going on in the event loop (such as a `"message"` listener) for the worker to continue running.