In my Vue project, I would like to load a script from a server (e. g. https://myurl.com/API.js).
The script contains a variable, which I would like to use in my Vue component (view).
The problem is that when I load that scrip using the loadScript module:
import Vue from 'vue'
import LoadScript from 'vue-plugin-load-script';
Vue.use(LoadScript);
Vue.loadScript('https://quvia.cz:4443/portalAPI.js')
It is then loaded after the Vue component, so when try to console.log(externalScriptVariable), it is undefined. If I would setTimeout for 1 second, it would output the variable just fine.
What can I do in Vue.js to "await" the script loading, so it would load before every other Vue component?