aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-01-19 20:35:01 -0500
committerHolden Rohrer <hr@hrhr.dev>2020-01-19 20:35:51 -0500
commit34c860ef99fa155591a657512985553ac3a599fd (patch)
tree84defa9ed5d72ea69bbd7a761a95e385ca214820 /utils
parent920a59aa22f0a2dcb3cc9cd00a54e977904cdcf4 (diff)
added wrapper for socket.js writes
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;