mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 17:03:49 +01:00
Refactor
This commit is contained in:
parent
10324cd1b5
commit
47259037b4
@ -91,21 +91,23 @@ export default Vue.extend({
|
||||
followRequestDone: false,
|
||||
groupInviteDone: false,
|
||||
connection: null,
|
||||
readObserver: new IntersectionObserver((entries, observer) => {
|
||||
if (!entries.some(entry => entry.isIntersecting)) return;
|
||||
this.$root.stream.send('readNotification', {
|
||||
id: this.notification.id
|
||||
});
|
||||
entries.map(({ target }) => observer.unobserve(target));
|
||||
}),
|
||||
readObserver: null,
|
||||
faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck, faPollH
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (!this.notification.isRead) {
|
||||
if (!this.notification.isRead ) {
|
||||
this.readObserver = new IntersectionObserver((entries, observer) => {
|
||||
if (!entries.some(entry => entry.isIntersecting)) return;
|
||||
this.$root.stream.send('readNotification', {
|
||||
id: this.notification.id
|
||||
});
|
||||
entries.map(({ target }) => observer.unobserve(target));
|
||||
})
|
||||
|
||||
this.readObserver.observe(this.$el);
|
||||
|
||||
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('readAllNotifications', () => this.readObserver.unobserve(this.$el));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user