This commit is contained in:
syuilo 2018-10-09 05:11:42 +09:00
parent 7cf72f7447
commit 32371ed2bd
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 15 additions and 9 deletions

View File

@ -26,12 +26,14 @@ export default Vue.extend({
this.init();
},
beforeDestroy() {
this.connection.close();
this.connection.dispose();
},
methods: {
init() {
if (this.connection) this.connection.close();
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
if (this.connection) this.connection.dispose();
this.connection = (this as any).os.stream.connectToChannel('userList', {
listId: this.list.id
});
this.connection.on('note', this.onNote);
this.connection.on('userAdded', this.onUserAdded);
this.connection.on('userRemoved', this.onUserRemoved);

View File

@ -46,8 +46,10 @@ export default Vue.extend({
},
mounted() {
if (this.connection) this.connection.close();
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
if (this.connection) this.connection.dispose();
this.connection = (this as any).os.stream.connectToChannel('userList', {
listId: this.list.id
});
this.connection.on('note', this.onNote);
this.connection.on('userAdded', this.onUserAdded);
this.connection.on('userRemoved', this.onUserRemoved);
@ -56,7 +58,7 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.close();
this.connection.dispose();
},
methods: {

View File

@ -36,13 +36,15 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.close();
this.connection.dispose();
},
methods: {
init() {
if (this.connection) this.connection.close();
this.connection = new UserListStream((this as any).os, this.$store.state.i, this.list.id);
if (this.connection) this.connection.dispose();
this.connection = (this as any).os.stream.connectToChannel('userList', {
listId: this.list.id
});
this.connection.on('note', this.onNote);
this.connection.on('userAdded', this.onUserAdded);
this.connection.on('userRemoved', this.onUserRemoved);