Adapt config and link library to web

Make the config and link libraries compatible with packing for web with
webpack.  This would fail due to ws not being web compatible and config
using a node function not available in the web shim for util.
This commit is contained in:
Hornwitser committed 2020-09-28 04:19:00 +02:00
1 parent fbf2843f5b
commit f318f8826b
5 files changed
+54 -29

No files matched your search

+17
View File
@@ -18,6 +18,23 @@ class MockSocket {
this.events.set(event, fn);
}
/* eslint-disable accessor-pairs */
set onclose(fn) {
this.on("close", (code, reason) => fn({ code, reason }));
}
set onerror(fn) {
this.on("error", fn);
}
set onopen(fn) {
this.on("open", fn);
}
set onmessage(fn) {
this.on("message", (data) => fn({ data }));
}
terminate() {
this.terminateCalled = true;
}