I am importing value from store
import {store} from '../../store/store'
and I have Variable:-
let Data = {
textType: '',
textData: null
};
When i use console.log(store.state.testData)
Getting Below result in console:-
{__ob__: Observer}
counters:Array(4)
testCounters:Array(0)
__ob__:Observer {value: {…}, dep: Dep, vmCount: 0}
get counters:ƒ reactiveGetter()
set counters:ƒ reactiveSetter(newVal)
get usageUnitCounters:ƒ reactiveGetter()
set usageUnitCounters:ƒ reactiveSetter(newVal)
__proto__:Object
and when i directly access console.log(store.state.testData.testCounters)
Getting Below result in console:-
[__ob__: Observer]
length:0
__ob__:Observer {value: Array(0), dep: Dep, vmCount: 0}
__proto__:Array
but if i access console.log(store.state.testData.testCounters) with setTimeout then i get required value for testCounters.
setTimeout(() => {
console.log(tore.state.testData.testCounters);
}, 13000)
But i need to assign testCounter value to Data variable but as data is not available it pass blank value as defined. How can i wait untill testCounters Data will be available or do we have any other methods?
export { Data }