[Client] Fix bug

This commit is contained in:
syuilo 2017-03-21 18:26:11 +09:00
parent 3d4e3c1e88
commit 99b16d056b
3 changed files with 25 additions and 13 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <i@syuilo.com>", "author": "syuilo <i@syuilo.com>",
"version": "0.0.1410", "version": "0.0.1413",
"license": "MIT", "license": "MIT",
"description": "A miniblog-based SNS", "description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues", "bugs": "https://github.com/syuilo/misskey/issues",

View File

@ -364,24 +364,29 @@
} }
}; };
this.capture = () => { this.onStreamConnected = () => {
this.capture();
};
this.capture = withHandler => {
this.stream.send({ this.stream.send({
type: 'capture', type: 'capture',
id: this.post.id id: this.post.id
}); });
this.stream.on('post-updated', this.onStreamPostUpdated); if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
}; };
this.decapture = () => { this.decapture = withHandler => {
this.stream.send({ this.stream.send({
type: 'decapture', type: 'decapture',
id: this.post.id id: this.post.id
}); });
this.stream.off('post-updated', this.onStreamPostUpdated); if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
}; };
this.on('mount', () => { this.on('mount', () => {
this.capture(); this.capture(true);
this.stream.on('_connected_', this.onStreamConnected);
if (this.p.text) { if (this.p.text) {
const tokens = this.p.ast; const tokens = this.p.ast;
@ -404,7 +409,8 @@
}); });
this.on('unmount', () => { this.on('unmount', () => {
this.decapture(); this.decapture(true);
this.stream.off('_connected_', this.onStreamConnected);
}); });
this.reply = () => { this.reply = () => {

View File

@ -340,24 +340,29 @@
} }
}; };
this.capture = () => { this.onStreamConnected = () => {
this.capture();
};
this.capture = withHandler => {
this.stream.send({ this.stream.send({
type: 'capture', type: 'capture',
id: this.post.id id: this.post.id
}); });
this.stream.on('post-updated', this.onStreamPostUpdated); if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
}; };
this.decapture = () => { this.decapture = withHandler => {
this.stream.send({ this.stream.send({
type: 'decapture', type: 'decapture',
id: this.post.id id: this.post.id
}); });
this.stream.off('post-updated', this.onStreamPostUpdated); if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
}; };
this.on('mount', () => { this.on('mount', () => {
this.capture(); this.capture(true);
this.stream.on('_connected_', this.onStreamConnected);
if (this.p.text) { if (this.p.text) {
const tokens = this.p.ast; const tokens = this.p.ast;
@ -380,7 +385,8 @@
}); });
this.on('unmount', () => { this.on('unmount', () => {
this.decapture(); this.decapture(true);
this.stream.off('_connected_', this.onStreamConnected);
}); });
this.reply = () => { this.reply = () => {