diff options
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/worker_threads.ts | 7 |
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; } |