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

New tool: Dexie.waitFor() keeps transaction alive. #378

Merged
merged 1 commit into from
Nov 25, 2016
Merged

Conversation

dfahlander
Copy link
Collaborator

Inspired by @wwoods solution described in #374 and the new indexeddb-promises proposal, I've added the method Dexie.waitFor() that may wait on a non-indexedDB Promise or Promise-returning function to complete and keep transaction alive during the whole lifetime of that task.

Implementation was also inspired by the elegant code in polyfill.js by @inexorabletash.

Inspired by @wwoods solution described  in #374 and the new [indexeddb-promises proposal](inexorabletash/indexeddb-promises#11), I've added the method Dexie.waitFor() that may wait on a non-indexedDB Promise or Promise-returning function to complete and keep transaction alive during the whole lifetime of that task.

Implementation was also inspired by the elegant code in [polyfill.js](https://github.com/inexorabletash/indexeddb-promises/blob/master/polyfill.js) by @inexorabletash.
@dfahlander dfahlander merged commit c77520a into master Nov 25, 2016
@sechel
Copy link

sechel commented Nov 27, 2016

Typescript type definition update is missing.

@wwoods
Copy link
Contributor

wwoods commented Nov 28, 2016

@dfahlander Looks good to me, and should allow cleaner code than the writer / reader "threads" I was using. Perhaps a smidge less performant, but more than made up for by ease of use. Nice work 👍

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.

3 participants