I am working on a progressive web application project.
The main thread, inspection.js, starts a worker, inspectionworker.js, and detects when the user is offline or online. When online, the information a user submits is sent directly to the server. When offline, the data is sent to the web worker for storing in the local database until the user is back online. Once online again, the service worker is responsible for sending all the offline data to the server while the main thread is available for new inspections.
This was working when establishing a connection to the database using the JsStoreWorker directly. But after broader testing, I found out it was only working in Firefox and Chrome on my Mac. It failed in Safari and on mobile devices, saying the JsStoreWorker could not be found.
I thought this problem might be solved by including the JsStoreWorker.js as a script but not using it directly in creating the connection objects, but it's not working. As a test, when I try to add a record and I have not imported the JsStoreWorker.js, an error is thrown saying JsStoreWorker cannot be found. When I import the script and try to add a record, the add fails silently.
Based on the behavior/problem being similar in both cases, I am wondering if perhaps I cannot use JsStore in a web worker?
Thanks in advance for you help!!
JsStore supports only push functionality for now , check here - https://jsstore.net/tutorial/update-with-operators/
But you are free to use whatever operation you want to do on array by retrieving the value using select api.