Closed drfraser closed 9 months ago
Let me have a look at examples, will update it ASAP.
@drfraser have a look at this doc - https://jsstore.net/docs/connection#without-web-worker-1,
you just need to use the workerinjector plugin.
I just ran the typesctipt without worker example and it is working - https://github.com/ujjwalguptaofficial/jsstore-examples/tree/master/typescript_without_worker
@drfraser not sure if your issue is solved, but if not - please provide a example repo and i will help you.
Hey... i'm sorry for not getting back to you - work has been bad.... and I had to put all this aside. I did follow the examples and used the plugin, but was getting that error. I will try again and give you a repo after I get all this work dealt with.
Description
I am trying to run Jsstore in a web worker (Angular 15 application) and configure it to not use its own web worker which as I understand is possible.
But I am getting this error :
Uncaught TypeError: Cannot create property 'onResult' on string 'updateDb' at QueryManager.run (jsstore.worker.commonjs2.js:4712:25) at self.onmessage (jsstore.worker.commonjs2.js:4847:19)
My event handler / message passer is sending 'updatedb' to the event handler in the web worker. As far as I can tell, jsstore.worker.js and its IS_WORKER is being set to true and so a JSStore onmessage handler is also set up in my web worker. Thus the 'updatedb' message is getting processed two times despite my event handler calling event.stopImmediatePropagation(). I guess Jsstore's event handler is being set up first.
So what is the correct way to setup JSStore in a web worker and tell it not to use its own web worker? I have looked at all of the jsstore-examples and most seem to be old (less than v4) or not cover my exact situation
would explicitly using importScripts() and webpack-copy-plugin to copy the jsstore JS files to the right spot deal with this?
thanks!