So, imagine Vue index.html that also loads some custom script:
<!DOCTYPE html>
<html lang="en">
<head>
...
...
<script type="text/javascript">
languagePluginLoader.then(function () {
pyodide.loadPackage("someName").then(() => {
// Send message to Vue that everything is fine
}).catch((err) => {
// Send message to Vue that it failed
})
})
</script>
...
...
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
Is there a way to communicate with running Vue instance or/and Vuex from the index.html file? For example, I want to show "Loading..." until the script is fully loaded, etc.
One way will be to send the message to the service worker and then from the service worker to Vue, but it feels unpractical.
Another way is to set
windows.script_status = trueafter the initialization, butwindowobject is not reactive, so Vue will check it once, getundefinedand forget about it.UPD: Third way will be to inject scripts from the Vue side and put some function into
script.onloadto get when it's ready, but not sure how stable the solution is.
So, any advice will do :)