For example following code. I want to do some tasks repeatedly in my module and I depend on value of getter which doesn't get updated right now. How can I keep it in sync with my vuex state? Thank you.
Inside my Vuex
:
import { start, stop } from './externa-module.js
START_ACTION ({getters}) {
start(getters.myVuexGetters);
}
Inside my external-module.js
let myVuexGetter = null;
function doSomeStuffRepeatedly(){
console.log(myVuexGetter);
}
export function start(importedGetter){
myVuexGetter = importedGetter;
doSomeStuffRepeatedly();
}
Ok, it looks like I can't pass a single getter
but a whole getters
object which I get within the action
. If anyone has a better answer I will be glad to learn it.