diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-02-19 08:09:38 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-02-19 08:09:38 +0900 |
| commit | 5e5986f5f5b2882526af70f90206c35d67071951 (patch) | |
| tree | 65d1923a5d1c9db794717fe56daf404c4665923e /src/web/app/common/scripts | |
| parent | [Client] Fix bug (diff) | |
| download | misskey-5e5986f5f5b2882526af70f90206c35d67071951.tar.gz misskey-5e5986f5f5b2882526af70f90206c35d67071951.tar.bz2 misskey-5e5986f5f5b2882526af70f90206c35d67071951.zip | |
[Clinet] Fix bug
Diffstat (limited to 'src/web/app/common/scripts')
| -rw-r--r-- | src/web/app/common/scripts/messaging-stream.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/web/app/common/scripts/messaging-stream.js b/src/web/app/common/scripts/messaging-stream.js index e6fc6f8bd0..17634c0707 100644 --- a/src/web/app/common/scripts/messaging-stream.js +++ b/src/web/app/common/scripts/messaging-stream.js @@ -3,6 +3,12 @@ const riot = require('riot'); class Connection { 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.me = me; @@ -20,8 +26,8 @@ class Connection { onMessage(message) { try { - const message = JSON.parse(message.data); - if (message.type) this.event.trigger(message.type, message.body); + const msg = JSON.parse(message.data); + if (msg.type) this.event.trigger(msg.type, msg.body); } catch(e) { // noop } |