[Client] Fix bug, some refactorings
This commit is contained in:
parent
7eeb9c4962
commit
de5dc87cec
|
@ -45,6 +45,8 @@ class Connection {
|
|||
}
|
||||
|
||||
send(message) {
|
||||
// TODO: バッファリングしてつぎ接続した時に送信する
|
||||
if (this.state != 'connected') return;
|
||||
this.socket.send(JSON.stringify(message));
|
||||
}
|
||||
|
||||
|
|
|
@ -364,13 +364,24 @@
|
|||
}
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
this.capture = () => {
|
||||
this.stream.send({
|
||||
type: 'capture',
|
||||
id: this.p.id
|
||||
});
|
||||
|
||||
this.stream.event.on('post-updated', this.onStreamPostUpdated);
|
||||
};
|
||||
|
||||
this.decapture = () => {
|
||||
this.stream.send({
|
||||
type: 'decapture',
|
||||
id: this.p.id
|
||||
});
|
||||
this.stream.event.off('post-updated', this.onStreamPostUpdated);
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
this.capture();
|
||||
|
||||
if (this.p.text) {
|
||||
const tokens = this.p.ast;
|
||||
|
@ -393,12 +404,7 @@
|
|||
});
|
||||
|
||||
this.on('unmount', () => {
|
||||
this.stream.send({
|
||||
type: 'decapture',
|
||||
id: this.p.id
|
||||
});
|
||||
|
||||
this.stream.event.off('post-updated', this.onStreamPostUpdated);
|
||||
this.decapture();
|
||||
});
|
||||
|
||||
this.reply = () => {
|
||||
|
|
|
@ -340,13 +340,24 @@
|
|||
}
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
this.capture = () => {
|
||||
this.stream.send({
|
||||
type: 'capture',
|
||||
id: this.p.id
|
||||
});
|
||||
|
||||
this.stream.event.on('post-updated', this.onStreamPostUpdated);
|
||||
};
|
||||
|
||||
this.decapture = () => {
|
||||
this.stream.send({
|
||||
type: 'decapture',
|
||||
id: this.p.id
|
||||
});
|
||||
this.stream.event.off('post-updated', this.onStreamPostUpdated);
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
this.capture();
|
||||
|
||||
if (this.p.text) {
|
||||
const tokens = this.p.ast;
|
||||
|
@ -369,12 +380,7 @@
|
|||
});
|
||||
|
||||
this.on('unmount', () => {
|
||||
this.stream.send({
|
||||
type: 'decapture',
|
||||
id: this.p.id
|
||||
});
|
||||
|
||||
this.stream.event.off('post-updated', this.onStreamPostUpdated);
|
||||
this.decapture();
|
||||
});
|
||||
|
||||
this.reply = () => {
|
||||
|
|
Loading…
Reference in a new issue