lib: make AbortSignal cloneable/transferable · nodejs/node@438b9cf · GitHub
Skip to content

Commit 438b9cf

Browse files
jasnelldanielleadams
authored andcommitted
lib: make AbortSignal cloneable/transferable
Allows for using `AbortSignal` across worker threads and contexts. ```js const ac = new AbortController(); const mc = new MessageChannel(); mc.port1.onmessage = ({ data }) => { data.addEventListener('abort', () => { console.log('aborted!'); }); }; mc.port2.postMessage(ac.signal, [ac.signal]); ``` Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #41050 Refs: whatwg/dom#948 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Robert Nagy <ronagy@icloud.com>
1 parent 799cf57 commit 438b9cf

2 files changed

Lines changed: 169 additions & 5 deletions

File tree

lib/internal/abort_controller.js

Lines changed: 91 additions & 5 deletions
Lines changed: 78 additions & 0 deletions

0 commit comments

Comments
 (0)