From fdad4d2673e4882a042aa3522f9649d2c697e3d3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 10 Mar 2019 12:12:59 +0100 Subject: [PATCH] doc: document diverging MessagePort.onmessage handling Fixes: https://github.com/nodejs/node/issues/26463 PR-URL: https://github.com/nodejs/node/pull/26487 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/worker_threads.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 8d4c703f480de2..5152cc8c4d5708 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -319,6 +319,9 @@ listeners are attached. This method exists for parity with the Web `MessagePort` API. In Node.js, it is only useful for ignoring messages when no event listener is present. +Node.js also diverges in its handling of `.onmessage`. Setting it will +automatically call `.start()`, but unsetting it will let messages queue up +until a new handler is set or the port is discarded. ### port.unref()