aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/writewrap.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/writewrap.js b/utils/writewrap.js
new file mode 100644
index 0000000..96f1ad1
--- /dev/null
+++ b/utils/writewrap.js
@@ -0,0 +1,12 @@
+// 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 (w of acc) this.emit(w);
+ });
+ }
+}
+module.exports = wwrap;