summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-21 18:26:11 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-21 18:26:11 +0900
commit99b16d056b95b87efc4007b84619a4af950671b4 (patch)
tree1bf4af76b1397b0d15a2cea9bf810d8d9504bb03 /src/web
parent[Clinet:Desktop] (Design) Fix bug (diff)
downloadmisskey-99b16d056b95b87efc4007b84619a4af950671b4.tar.gz
misskey-99b16d056b95b87efc4007b84619a4af950671b4.tar.bz2
misskey-99b16d056b95b87efc4007b84619a4af950671b4.zip
[Client] Fix bug
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/desktop/tags/timeline-post.tag18
-rw-r--r--src/web/app/mobile/tags/timeline-post.tag18
2 files changed, 24 insertions, 12 deletions
diff --git a/src/web/app/desktop/tags/timeline-post.tag b/src/web/app/desktop/tags/timeline-post.tag
index 3961d5a5c7..4c07be6c81 100644
--- a/src/web/app/desktop/tags/timeline-post.tag
+++ b/src/web/app/desktop/tags/timeline-post.tag
@@ -364,24 +364,29 @@
}
};
- this.capture = () => {
+ this.onStreamConnected = () => {
+ this.capture();
+ };
+
+ this.capture = withHandler => {
this.stream.send({
type: 'capture',
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({
type: 'decapture',
id: this.post.id
});
- this.stream.off('post-updated', this.onStreamPostUpdated);
+ if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
};
this.on('mount', () => {
- this.capture();
+ this.capture(true);
+ this.stream.on('_connected_', this.onStreamConnected);
if (this.p.text) {
const tokens = this.p.ast;
@@ -404,7 +409,8 @@
});
this.on('unmount', () => {
- this.decapture();
+ this.decapture(true);
+ this.stream.off('_connected_', this.onStreamConnected);
});
this.reply = () => {
diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag
index 855d7ff911..6af909ba96 100644
--- a/src/web/app/mobile/tags/timeline-post.tag
+++ b/src/web/app/mobile/tags/timeline-post.tag
@@ -340,24 +340,29 @@
}
};
- this.capture = () => {
+ this.onStreamConnected = () => {
+ this.capture();
+ };
+
+ this.capture = withHandler => {
this.stream.send({
type: 'capture',
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({
type: 'decapture',
id: this.post.id
});
- this.stream.off('post-updated', this.onStreamPostUpdated);
+ if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
};
this.on('mount', () => {
- this.capture();
+ this.capture(true);
+ this.stream.on('_connected_', this.onStreamConnected);
if (this.p.text) {
const tokens = this.p.ast;
@@ -380,7 +385,8 @@
});
this.on('unmount', () => {
- this.decapture();
+ this.decapture(true);
+ this.stream.off('_connected_', this.onStreamConnected);
});
this.reply = () => {