This commit is contained in:
syuilo
2020-09-06 13:04:44 +09:00
parent d4085085b8
commit cc35f2c186
18 changed files with 38 additions and 44 deletions

View File

@@ -141,7 +141,7 @@ export default defineComponent({
});
}
this.connection = this.$root.stream.useSharedConnection('drive');
this.connection = os.stream.useSharedConnection('drive');
this.connection.on('fileCreated', this.onStreamDriveFileCreated);
this.connection.on('fileUpdated', this.onStreamDriveFileUpdated);

View File

@@ -69,7 +69,7 @@ export default defineComponent({
},
mounted() {
this.connection = this.$root.stream.useSharedConnection('main');
this.connection = os.stream.useSharedConnection('main');
this.connection.on('follow', this.onFollowChange);
this.connection.on('unfollow', this.onFollowChange);

View File

@@ -253,7 +253,7 @@ export default defineComponent({
async created() {
if (this.$store.getters.isSignedIn) {
this.connection = this.$root.stream;
this.connection = os.stream;
}
// plugin

View File

@@ -104,7 +104,7 @@ export default defineComponent({
if (!this.notification.isRead) {
this.readObserver = new IntersectionObserver((entries, observer) => {
if (!entries.some(entry => entry.isIntersecting)) return;
this.$root.stream.send('readNotification', {
os.stream.send('readNotification', {
id: this.notification.id
});
entries.map(({ target }) => observer.unobserve(target));
@@ -112,7 +112,7 @@ export default defineComponent({
this.readObserver.observe(this.$el);
this.connection = this.$root.stream.useSharedConnection('main');
this.connection = os.stream.useSharedConnection('main');
this.connection.on('readAllNotifications', () => this.readObserver.unobserve(this.$el));
}
},

View File

@@ -75,7 +75,7 @@ export default defineComponent({
},
mounted() {
this.connection = this.$root.stream.useSharedConnection('main');
this.connection = os.stream.useSharedConnection('main');
this.connection.on('notification', this.onNotification);
},
@@ -88,7 +88,7 @@ export default defineComponent({
//
const isMuted = !!this.allIncludeTypes && !this.allIncludeTypes.includes(notification.type);
if (isMuted || document.visibilityState === 'visible') {
this.$root.stream.send('readNotification', {
os.stream.send('readNotification', {
id: notification.id
});
}

View File

@@ -20,14 +20,14 @@ export default defineComponent({
},
computed: {
stream() {
return this.$root.stream;
return os.stream;
},
},
created() {
this.$root.stream.on('_disconnected_', this.onDisconnected);
os.stream.on('_disconnected_', this.onDisconnected);
},
beforeDestroy() {
this.$root.stream.off('_disconnected_', this.onDisconnected);
os.stream.off('_disconnected_', this.onDisconnected);
},
methods: {
onDisconnected() {

View File

@@ -88,36 +88,36 @@ export default defineComponent({
this.query = {
antennaId: this.antenna
};
this.connection = this.$root.stream.connectToChannel('antenna', {
this.connection = os.stream.connectToChannel('antenna', {
antennaId: this.antenna
});
this.connection.on('note', prepend);
} else if (this.src == 'home') {
endpoint = 'notes/timeline';
this.connection = this.$root.stream.useSharedConnection('homeTimeline');
this.connection = os.stream.useSharedConnection('homeTimeline');
this.connection.on('note', prepend);
this.connection2 = this.$root.stream.useSharedConnection('main');
this.connection2 = os.stream.useSharedConnection('main');
this.connection2.on('follow', onChangeFollowing);
this.connection2.on('unfollow', onChangeFollowing);
} else if (this.src == 'local') {
endpoint = 'notes/local-timeline';
this.connection = this.$root.stream.useSharedConnection('localTimeline');
this.connection = os.stream.useSharedConnection('localTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'social') {
endpoint = 'notes/hybrid-timeline';
this.connection = this.$root.stream.useSharedConnection('hybridTimeline');
this.connection = os.stream.useSharedConnection('hybridTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'global') {
endpoint = 'notes/global-timeline';
this.connection = this.$root.stream.useSharedConnection('globalTimeline');
this.connection = os.stream.useSharedConnection('globalTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'list') {
endpoint = 'notes/user-list-timeline';
this.query = {
listId: this.list
};
this.connection = this.$root.stream.connectToChannel('userList', {
this.connection = os.stream.connectToChannel('userList', {
listId: this.list
});
this.connection.on('note', prepend);
@@ -128,7 +128,7 @@ export default defineComponent({
this.query = {
channelId: this.channel
};
this.connection = this.$root.stream.connectToChannel('channel', {
this.connection = os.stream.connectToChannel('channel', {
channelId: this.channel
});
this.connection.on('note', prepend);