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
(#1166) - web workers #1169
(#1166) - web workers #1169
Conversation
this is rebased and ready to merge (or a 👍 ) |
once this gets merged we should prabably publish version 1.1.0. possibly when @daleharvey is done with his Christmas cruise. |
Looks perfect, thanks a lot 👍 |
merged 8f73143 |
I think web worker is important for browser. Especially iOS on older devices (iPad2), whenever I run bulkDocs the UI could freeze for a while. I attempted to change all "window" references in pouch-nightly.js to "self", and confirmed it worked in a worker thread, database is saved. The problem is that changes listener is not notified. I think the issue could be api.notifyLocalWindows, which update localStorage to notify changes (?), but localStorage is not available in web worker. |
@hongnk the current up to date build works in a worker and we test for it now, but as indexedDB and websql aren't available there it can only act as a client for the html adapter. I'm not sure what your trying to say in part 2 of your comment ... |
Hi Calvin, indexedDB and websql both works fine in web worker (maybe only for newer browser). I tested on Chrome 31 and Safari 6.1 and iOS 7. The only changes needed in pouchdb-nightly.js is to change if(window!=undefined) to if (self!=undefined), or window.openDatabase to self.openDatabase etc ... And after this change the script still works as usual in main thread. However as I said, localStorage is not available in worker and therefore listening to onstorage to notify changes doesn't work. |
Opened a new issue, I think if we use global, browserify will deal with
|
fix in the ajax section and some basic tests for workers