From 31950681906e9e715b7505b5a248443abef6bc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Mo=CC=88bus?= Date: Thu, 30 Nov 2023 15:37:55 +0100 Subject: [PATCH] added conditional check to only initialize messenger instance once --- src/install.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/install.js b/src/install.js index 4c2ffcd..4c13921 100644 --- a/src/install.js +++ b/src/install.js @@ -19,11 +19,9 @@ function install(Vue, options = {}) { Vue.mixin({ mounted() { - const root = new Vue(); - - new TawkMessenger(root, options); - - Vue.prototype.$tawkMessenger = root; + if (!Vue.prototype.$tawkMessenger) { + Vue.prototype.$tawkMessenger = new TawkMessenger(this.$root, options); + } } }); }