summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/worker_threads.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/worker_threads.ts')
-rw-r--r--ext/node/polyfills/worker_threads.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts
index b51049af5..3519ae217 100644
--- a/ext/node/polyfills/worker_threads.ts
+++ b/ext/node/polyfills/worker_threads.ts
@@ -536,6 +536,13 @@ function webMessagePortToNodeMessagePort(port: MessagePort) {
port.ref = () => {
port[refMessagePort](true);
};
+ port.once = (name: string | symbol, listener) => {
+ const fn = (event) => {
+ port.off(name, fn);
+ return listener(event);
+ };
+ port.on(name, fn);
+ };
return port;
}