diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/writewrap.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/utils/writewrap.js b/utils/writewrap.js index 3ca7ede..2e2ae07 100644 --- a/utils/writewrap.js +++ b/utils/writewrap.js @@ -1,12 +1,11 @@ // An EventEmitter wrapper for socket.js writes const EventEmitter = require('events'); -class wwrap extends EventEmitter{ - constructor(socket){ - super(); - socket.on('write', (acc) => { // Assumed that none are rejected because I've never seen it - for (let w of acc) this.emit(w); - }); - } +function wwrap(){ // should be called with wwrap.call(socket) + let self = this; + self.on('write', (acc) => { + for (let w of acc) this.emit(w); + }); } + module.exports = wwrap; |