This commit is contained in:
syuilo
2017-10-25 20:48:45 +09:00
parent 5a9b2a1255
commit a41a05de31
5 changed files with 62 additions and 38 deletions

View File

@ -467,6 +467,7 @@
import getPostSummary from '../../../../common/get-post-summary.ts';
import openPostForm from '../scripts/open-post-form';
this.mixin('i');
this.mixin('api');
this.mixin('stream');
@ -502,24 +503,31 @@
};
this.capture = withHandler => {
this.stream.send({
type: 'capture',
id: this.post.id
});
if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
if (this.SIGNIN) {
this.stream.send({
type: 'capture',
id: this.post.id
});
if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
}
};
this.decapture = withHandler => {
this.stream.send({
type: 'decapture',
id: this.post.id
});
if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
if (this.SIGNIN) {
this.stream.send({
type: 'decapture',
id: this.post.id
});
if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
}
};
this.on('mount', () => {
this.capture(true);
this.stream.on('_connected_', this.onStreamConnected);
if (this.SIGNIN) {
this.stream.on('_connected_', this.onStreamConnected);
}
if (this.p.text) {
const tokens = this.p.ast;

View File

@ -4,7 +4,7 @@
<div class="content">
<yield />
</div>
<mk-stream-indicator/>
<mk-stream-indicator if={ SIGNIN }/>
<style>
:scope
display block