mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 17:29:05 +01:00
[Clinet] Fix bug
This commit is contained in:
parent
3f7da98b36
commit
725c008966
@ -3,6 +3,12 @@ const riot = require('riot');
|
|||||||
|
|
||||||
class Connection {
|
class Connection {
|
||||||
constructor(me, otherparty) {
|
constructor(me, otherparty) {
|
||||||
|
// BIND -----------------------------------
|
||||||
|
this.onOpen = this.onOpen.bind(this);
|
||||||
|
this.onMessage = this.onMessage.bind(this);
|
||||||
|
this.close = this.close.bind(this);
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
this.event = riot.observable();
|
this.event = riot.observable();
|
||||||
this.me = me;
|
this.me = me;
|
||||||
|
|
||||||
@ -20,8 +26,8 @@ class Connection {
|
|||||||
|
|
||||||
onMessage(message) {
|
onMessage(message) {
|
||||||
try {
|
try {
|
||||||
const message = JSON.parse(message.data);
|
const msg = JSON.parse(message.data);
|
||||||
if (message.type) this.event.trigger(message.type, message.body);
|
if (msg.type) this.event.trigger(msg.type, msg.body);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user