From 137d3d2734a6f6e891ebab68ec6da16c8a6b397c Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 10 Mar 2019 12:12:59 +0100 Subject: 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(+) (limited to 'doc/api/worker_threads.md') diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 8d4c703f48..5152cc8c4d 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()