-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Unit tests for web workers #1166
Comments
so the switch to browserify removed the references to window, so in principle there is no reason you can't use it in a web worker (besides the lack of indexed db). have you tried using it to connect to an http database yet? you can use importScripts to load pouchdb Due to poor design of the web worker api libraries can not create web workers so pouch would be restricted to operating 100% inside a web worker or not at all in the worker, e.g. no custom message passing algorithms like @daleharvey suggested on the mailing list, you might be able to hack it together for chrome and firefox but IE is a no go there. |
Great, I haven't tried it yet I have just been getting a steady stream of emails from that bugzilla ticket and figured I would post here. In my use-case, I don't even need postMessage. I'm trying to mix http and https content but since Firefox blocks http JS in https sites I have to go the other way around: have an http site load an https worker. But the http site doesn't need to communicate with the worker, the worker is just updating client-side storage in the background for when the site can be https only. Maybe we should change the ticket to "Create unit tests for web workers" ? |
yes we can consider this a unit test for workers ticket. For now you could try loading a https iframe |
as it turns out there is a reference to window in the ajax section, so I fixed that and have a pull for that plus basic tests that just create a db, put a doc in, and get it agin. |
Fucking A', that was fast! I'm using this as the backend to Speech.is, your contribs will be put to good use : ) |
merged 8f73143 |
Since moving to browserfy, PouchDB in web workers should work in any web browser which supports web workers database access using the async IndexDB API without any additional modifications.
Currently, only Chrome supports indexDB access from webworkers, however, there has been a recent flurry of activity on over at Bugzilla and it looks like it's close to being implemented.
The "only" thing left is creating unit tests.
The text was updated successfully, but these errors were encountered: