@@ -64,7 +64,7 @@ import Vue from 'vue';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import * as uuid from 'uuid';
|
||||
import Progress from '../../../common/scripts/loading';
|
||||
import getPostSummary from '../../../../../renderers/get-post-summary';
|
||||
import getNoteSummary from '../../../../../renderers/get-note-summary';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
@@ -124,14 +124,14 @@ export default Vue.extend({
|
||||
this.connection = (this as any).os.stream.getConnection();
|
||||
this.connectionId = (this as any).os.stream.use();
|
||||
|
||||
this.connection.on('post', this.onStreamPost);
|
||||
this.connection.on('note', this.onStreamNote);
|
||||
this.connection.on('mobile_home_updated', this.onHomeUpdated);
|
||||
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
||||
|
||||
Progress.start();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.connection.off('post', this.onStreamPost);
|
||||
this.connection.off('note', this.onStreamNote);
|
||||
this.connection.off('mobile_home_updated', this.onHomeUpdated);
|
||||
(this as any).os.stream.dispose(this.connectionId);
|
||||
document.removeEventListener('visibilitychange', this.onVisibilitychange);
|
||||
@@ -143,10 +143,10 @@ export default Vue.extend({
|
||||
onLoaded() {
|
||||
Progress.done();
|
||||
},
|
||||
onStreamPost(post) {
|
||||
if (document.hidden && post.userId !== (this as any).os.i.id) {
|
||||
onStreamNote(note) {
|
||||
if (document.hidden && note.userId !== (this as any).os.i.id) {
|
||||
this.unreadCount++;
|
||||
document.title = `(${this.unreadCount}) ${getPostSummary(post)}`;
|
||||
document.title = `(${this.unreadCount}) ${getNoteSummary(note)}`;
|
||||
}
|
||||
},
|
||||
onVisibilitychange() {
|
||||
|
Reference in New Issue
Block a user