Distopico Vegan 9e639edc8d | 6 years ago | |
---|---|---|
.. | ||
LICENSE | 6 years ago | |
README.md | 6 years ago | |
index.js | 6 years ago | |
package.json | 6 years ago |
The safe way to handle the
connect
socket event
Once you receive the socket, it may be already connected.
To avoid checking that, use defer-to-connect
. It'll do that for you.
const deferToConnect = require('defer-to-connect');
deferToConnect(socket, () => {
console.log('Connected!');
});
Calls socket[method](...args)
when connected.
Calls fn()
when connected.
MIT