Refactor
This commit is contained in:
parent
7cdb790f4e
commit
d5f92eed8c
69 changed files with 314 additions and 330 deletions
|
@ -72,7 +72,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = new MessagingStream((this as any).os, (this as any).os.i, this.user.id);
|
||||
this.connection = new MessagingStream((this as any).os, this.$store.state.i, this.user.id);
|
||||
|
||||
this.connection.on('message', this.onMessage);
|
||||
this.connection.on('read', this.onRead);
|
||||
|
@ -164,7 +164,7 @@ export default Vue.extend({
|
|||
const isBottom = this.isBottom();
|
||||
|
||||
this.messages.push(message);
|
||||
if (message.userId != (this as any).os.i.id && !document.hidden) {
|
||||
if (message.userId != this.$store.state.i.id && !document.hidden) {
|
||||
this.connection.send({
|
||||
type: 'read',
|
||||
id: message.id
|
||||
|
@ -176,7 +176,7 @@ export default Vue.extend({
|
|||
this.$nextTick(() => {
|
||||
this.scrollToBottom();
|
||||
});
|
||||
} else if (message.userId != (this as any).os.i.id) {
|
||||
} else if (message.userId != this.$store.state.i.id) {
|
||||
// Notify
|
||||
this.notifyNewMessage();
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ export default Vue.extend({
|
|||
onVisibilitychange() {
|
||||
if (document.hidden) return;
|
||||
this.messages.forEach(message => {
|
||||
if (message.userId !== (this as any).os.i.id && !message.isRead) {
|
||||
if (message.userId !== this.$store.state.i.id && !message.isRead) {
|
||||
this.connection.send({
|
||||
type: 'read',
|
||||
id: message.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue