mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-05 00:03:58 +02:00
@@ -7,7 +7,7 @@
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import Progress from '../../../common/scripts/loading';
|
||||
import getPostSummary from '../../../../../renderers/get-post-summary';
|
||||
import getNoteSummary from '../../../../../renderers/get-note-summary';
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
@@ -29,13 +29,13 @@ 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);
|
||||
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
||||
|
||||
Progress.start();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.connection.off('post', this.onStreamPost);
|
||||
this.connection.off('note', this.onStreamNote);
|
||||
(this as any).os.stream.dispose(this.connectionId);
|
||||
document.removeEventListener('visibilitychange', this.onVisibilitychange);
|
||||
},
|
||||
@@ -44,10 +44,10 @@ export default Vue.extend({
|
||||
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)}`;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user