From 34c860ef99fa155591a657512985553ac3a599fd Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sun, 19 Jan 2020 20:35:01 -0500
Subject: added wrapper for socket.js writes
---
utils/writewrap.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 utils/writewrap.js
(limited to 'utils')
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;
--
cgit