vue-worker icon indicating copy to clipboard operation
vue-worker copied to clipboard

vuex and vue-worker

Open devszr opened this issue 6 years ago • 4 comments

Is it possible to access the vuex store from within a function passed onto a worker ?

devszr avatar Mar 20 '18 21:03 devszr

I'd like to know this too, please.

rconstantine avatar Nov 14 '18 22:11 rconstantine

I would like to know simply how to call a worker from a VueX action. Can somebody provide some guidance?

alejandroiglesias avatar Nov 29 '19 16:11 alejandroiglesias

Is it possible to access the vuex store from within a function passed onto a worker ?

This is likely not possible (or not feasible), because Web Workers don't share any data with the main thread. By design, communication between workers is done by passing messages, and such data is copied but never "shared".

While technically it could be possible to set up a bunch of messages so that a worker could ask for data from the main thread, this is likely going to increase the overhead and the complexity of the code, and making it much slower to run and harder to maintain.

denilsonsa avatar Feb 10 '20 15:02 denilsonsa

Not true. Currently indexedb is blocking - and if you want to sync the store with your indexedb instance without freezing the DOM - using workers is the only way to make it truly non blocking. And yes, it is possible. The app will be faster. However I do not know if the module allows it, I have used worker-loader module before.

siloam avatar Jul 14 '20 05:07 siloam