Skip to content
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

Closed
wants to merge 1 commit into from
Closed

(#1166) - web workers #1169

wants to merge 1 commit into from

Conversation

calvinmetcalf
Copy link
Member

fix in the ajax section and some basic tests for workers

@calvinmetcalf
Copy link
Member Author

this is rebased and ready to merge (or a 👍 )

@calvinmetcalf
Copy link
Member Author

once this gets merged we should prabably publish version 1.1.0. possibly when @daleharvey is done with his Christmas cruise.

@daleharvey
Copy link
Member

Looks perfect, thanks a lot 👍

@calvinmetcalf
Copy link
Member Author

merged 8f73143

@hongnk
Copy link

hongnk commented Jan 8, 2014

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.

@calvinmetcalf
Copy link
Member Author

@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 ...

@hongnk
Copy link

hongnk commented Jan 9, 2014

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.

@calvinmetcalf
Copy link
Member Author

Opened a new issue, I think if we use global, browserify will deal with
window and self changes
On Jan 8, 2014 7:18 PM, "hongnk" notifications@github.com wrote:

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 is onstorage to notify changes doesn't work.


Reply to this email directly or view it on GitHubhttps://github.com/daleharvey/pouchdb/pull/1169#issuecomment-31891003
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants