I am working on a web application (vue built with webpack) in which two different web workers are running. One is handling incoming data the other one is handling outgoing data.
In both workers reading and writing operations need to get executed.
Since each worker runs on a separate thread calling them like this
// in worker 1
const dbObj1 = new Dexie('my-db');
dbObj1.version(1).stores({...});
// in worker 2
const dbObj2 = new Dexie('my-db');
dbObj1.version(1).stores({...});
is very likely to create race conditions.
Using a singleton database object wouldn't work either because of the separate threads.
Is there any way I can have access to the dexie database in both workers, without running into problems?