-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seems to not really use microtasks inside a Web Worker #27
Comments
Also, I posted the same question on Stack Overflow http://stackoverflow.com/questions/42660581/microtasks-inside-web-workers so if you know the answer, you can get some free Internet points too :) |
I used to have a web worker specific thing in here and I don't remember if
I took it out, I can look into it next week but you could try an older
version of the library.
…On Wed, Mar 8, 2017, 2:02 AM Jeremy Scheff ***@***.***> wrote:
Also, I posted the same question on Stack Overflow
http://stackoverflow.com/questions/42660581/microtasks-inside-web-workers
so if you know the answer, you can get some free Internet points too :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABE4n6ZiVCPU3UruP-74rLKtgcCCOSs0ks5rjfAcgaJpZM4MWLyZ>
.
|
It's using |
answered on stack exchange but basically there isn't a good way to do microtasks in a web worker, but the real issue is that promises and IDB arn't in sync re tasks I've reached out to some people on twitter who are likely to be in the know so we can see what they have to say. |
ok so there is this article and this issue dexie/Dexie.js#317 |
I'm trying to use Promises with IndexedDB inside a Web Worker. Outside of a Web Worker, I know this is tricky... native promises work in Chrome, but in Firefox you need a polyfill that correctly uses microtasks, such as your
lie
library which relies on this project for queuing microtasks.That works fine, except inside a Web Worker there is no
MutationObserver
so you need to use other tricks. That seems to not play nice with IndexedDB transactions. Here's an example. Runnpm start
, go to the URLs it tells you to, and look in the console. You'll see that the same simple IndexedDB code works when required directly in the browser, but fails in a worker. Inside the worker, it closes the transaction before it runs the callback of theimmediate
function.Can you think of any possible solution to this problem besides synchronous promise resolution?
The text was updated successfully, but these errors were encountered: