Is it possible to create a Promise that resolves once a variable in the global vuex store changes?
I have a variable that is initialized as null
in the state store and will be populated via an asynchronous call.
A different part of the app is dependent on that variable being true
or false
and is supposed to wait while it is still null
.
Is there a way to cleanly wait for the change of this variable?
while(state.foo == undefined) { wait(100); } resolve(state.foo)
but I don't know if that's possible and how to make that work... – Precocity