diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-01-18 17:28:05 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-01-18 17:28:05 -0500 |
commit | 779ad8a69c031b768d16af79154a30e92730e5c3 (patch) | |
tree | 939e6971be97c2ba6e2e9ab1478614314f4922c5 /utils | |
parent | 71f281b208e71014fa61c23a943b1b326272556e (diff) |
moved deinit on close to ident.js
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ident.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/ident.js b/utils/ident.js index 6d18b88..f526afc 100644 --- a/utils/ident.js +++ b/utils/ident.js @@ -1,6 +1,6 @@ // A portable script to find the sender when the server websocket opens (by cursor movement) -module.exports = function identify(sock, initOnce, init){ +module.exports = function identify(sock, initOnce, init, deinit){ // `sock` should be Socket instance. // initOnce and init should be functions that act like they describe; initOnce runs once per program execution and init whenever the socket turns back on @@ -17,6 +17,8 @@ module.exports = function identify(sock, initOnce, init){ } } + sock.on('close', deinit); + // Calls initOnce and init on successful identification. let initialized = false; function identity(send){ |