diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2022-03-23 12:04:20 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 12:04:20 +0900 |
commit | 7feb25d448b356ac869ef919c57ef314382a8eb7 (patch) | |
tree | 35b5137590366e915750ab19d6c3b7dbd3dfe32d /ext/net/04_net_unstable.js | |
parent | 5c9844e5f7074b2623ff0ddd69f5adcd1356ae38 (diff) |
feat(unstable): add ref/unref to Listener (#13961)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/net/04_net_unstable.js')
-rw-r--r-- | ext/net/04_net_unstable.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/net/04_net_unstable.js b/ext/net/04_net_unstable.js index e22c9bf93..fcdb3c547 100644 --- a/ext/net/04_net_unstable.js +++ b/ext/net/04_net_unstable.js @@ -7,9 +7,9 @@ function listen(options) { if (options.transport === "unix") { const res = net.opListen(options); - return new net.Listener(res.rid, res.localAddr); + return new Listener(res.rid, res.localAddr); } else { - return net.listen(options); + return net.listen(options, Listener); } } @@ -41,9 +41,20 @@ } } + class Listener extends net.Listener { + ref() { + this[net.listenerRef](); + } + + unref() { + this[net.listenerUnref](); + } + } + window.__bootstrap.netUnstable = { connect, listenDatagram, listen, + Listener, }; })(this); |