Injecting WAA via ref to account for load delay.

This commit is contained in:
Jarek Rozanski 2023-03-14 21:42:12 +00:00
parent 30c0b72eea
commit ef6770f031
6 changed files with 49 additions and 15 deletions

View file

@ -1,9 +1,15 @@
import { initWideAngle } from "./src";
import { ref } from 'vue';
export default {
install: (app, options) => {
install: async (app, options) => {
const waaRef = ref()
app.provide('waa', waaRef);
initWideAngle(options)
.then(waa => { app.provide('waa', waa); })
.then(waa => {
waaRef.value = waa;
console.debug("[WAA] Wide Angle Analytics instance available");
})
.catch(e => { console.error("Failed to load Wide Angle Plugin", e)});
}
}