From 91e03494866180b0c66854f4409dfe58b5305128 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 11 Nov 2019 23:39:09 +0200 Subject: [PATCH] Use global Vue calls instead of vueApp reference --- client/js/contextMenuFactory.js | 5 +++-- client/js/socket-events/more.js | 5 +++-- client/js/socket-events/msg_preview.js | 5 +++-- client/js/socket-events/network.js | 6 ++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/js/contextMenuFactory.js b/client/js/contextMenuFactory.js index 3a199935..4694414c 100644 --- a/client/js/contextMenuFactory.js +++ b/client/js/contextMenuFactory.js @@ -1,12 +1,13 @@ "use strict"; +import Vue from "vue"; + const $ = require("jquery"); const socket = require("./socket"); const utils = require("./utils"); const ContextMenu = require("./contextMenu"); const contextMenuActions = []; const contextMenuItems = []; -const {vueApp} = require("./vue"); const {switchToChannel, navigate} = require("./router"); const store = require("./store").default; @@ -327,7 +328,7 @@ function addEditTopicItem() { store.getters.findChannel(Number(itemData)).channel.editTopic = true; document.querySelector(`#sidebar .chan[data-id="${Number(itemData)}"]`).click(); - vueApp.$nextTick(() => { + Vue.nextTick(() => { document.querySelector(`#chan-${Number(itemData)} .topic-input`).focus(); }); } diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index 2be668a1..dd822824 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -1,7 +1,8 @@ "use strict"; +import Vue from "vue"; + const socket = require("../socket"); -const {vueApp} = require("../vue"); const store = require("../store").default; socket.on("more", function(data) { @@ -15,7 +16,7 @@ socket.on("more", function(data) { data.totalMessages > channel.channel.messages.length + data.messages.length; channel.channel.messages.unshift(...data.messages); - vueApp.$nextTick(() => { + Vue.nextTick(() => { channel.channel.historyLoading = false; }); }); diff --git a/client/js/socket-events/msg_preview.js b/client/js/socket-events/msg_preview.js index 6b237eec..ba43f11e 100644 --- a/client/js/socket-events/msg_preview.js +++ b/client/js/socket-events/msg_preview.js @@ -1,7 +1,8 @@ "use strict"; +import Vue from "vue"; + const socket = require("../socket"); -const {vueApp} = require("../vue"); const store = require("../store").default; socket.on("msg:preview", function(data) { @@ -15,6 +16,6 @@ socket.on("msg:preview", function(data) { const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link); if (previewIndex > -1) { - vueApp.$set(message.previews, previewIndex, data.preview); + Vue.set(message.previews, previewIndex, data.preview); } }); diff --git a/client/js/socket-events/network.js b/client/js/socket-events/network.js index bd7e93dd..de280404 100644 --- a/client/js/socket-events/network.js +++ b/client/js/socket-events/network.js @@ -1,7 +1,9 @@ "use strict"; +import Vue from "vue"; + const socket = require("../socket"); -const {vueApp, initChannel} = require("../vue"); +const {initChannel} = require("../vue"); const store = require("../store").default; const {switchToChannel} = require("../router"); @@ -58,6 +60,6 @@ socket.on("network:info", function(data) { } for (const key in data) { - vueApp.$set(network, key, data[key]); + Vue.set(network, key, data[key]); } });