I have a chess program that searches at various depths, and I want to update the view between every depth searched, like after depth 1, after depth 2 and so one. So I pass a callback function to the chess solving function:
updateAiInfo: (depth) => {
this.depth = depth;
this.$forceUpdate();
console.log('check');
}
It's being called between every depth searched, it prints check, and I know that the vue property depth is being changed, I have double checked that, but the vue does not update until after the chess solving function is finished. How can I update the vue view instantly?
Edit: Since it's an es6 arrow function, this
will not change, it will stay bound to the vue instance. This function is passed to the chess function inside mounted()
.