@crypticat/core
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -39,3 +39,3 @@ "use strict"; | ||
lib_1.assertDefined(this.ws); | ||
this.ws.off('open', listeners.open); | ||
this.ws.removeEventListener('open', listeners.open); | ||
reject(error); | ||
@@ -45,10 +45,10 @@ }, | ||
lib_1.assertDefined(this.ws); | ||
this.ws.off('open', listeners.error); | ||
this.ws.removeEventListener('open', listeners.error); | ||
resolve(); | ||
} | ||
}; | ||
this.ws.once('error', listeners.error); | ||
this.ws.once('open', listeners.open); | ||
this.ws.addEventListener('error', listeners.error); | ||
this.ws.addEventListener('open', listeners.open); | ||
}); | ||
this.ws.on('message', (message) => { | ||
this.ws.addEventListener('message', (message) => { | ||
lib_1.assertDefined(this.ws); | ||
@@ -110,3 +110,3 @@ const { action, payload } = JSON.parse(message); | ||
}); | ||
this.ws.on('close', () => this.emit('disconnect')); | ||
this.ws.addEventListener('close', () => this.emit('disconnect')); | ||
}); | ||
@@ -113,0 +113,0 @@ } |
@@ -8,7 +8,7 @@ "use strict"; | ||
if (action === wantedAction) { | ||
ws.off('message', listener); | ||
ws.removeEventListener('message', listener); | ||
resolve(payload); | ||
} | ||
}; | ||
ws.on('message', listener); | ||
ws.addEventListener('message', listener); | ||
}); | ||
@@ -15,0 +15,0 @@ function assertDefined(thing) { |
@@ -42,3 +42,3 @@ "use strict"; | ||
lib_1.assertDefined(this.wss); | ||
this.wss.on('connection', (ws) => __awaiter(this, void 0, void 0, function* () { | ||
this.wss.addEventListener('connection', (ws) => __awaiter(this, void 0, void 0, function* () { | ||
const uid = yield uid_promise_1.default(20); | ||
@@ -95,3 +95,3 @@ this.sockets[uid] = ws; | ||
}); | ||
ws.on('message', (message) => __awaiter(this, void 0, void 0, function* () { | ||
ws.addEventListener('message', (message) => __awaiter(this, void 0, void 0, function* () { | ||
const { action, payload } = JSON.parse(message); | ||
@@ -161,3 +161,3 @@ switch (action) { | ||
})); | ||
ws.on('close', () => { | ||
ws.addEventListener('close', () => { | ||
this.emit('disconnect', uid); | ||
@@ -164,0 +164,0 @@ leaveRoom(); |
{ | ||
"name": "@crypticat/core", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Crypticat's core client and server implementation", | ||
@@ -5,0 +5,0 @@ "author": "Kognise <felix.mattick@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30249