Add early callback#13
Open
brettz9 wants to merge 2 commits into
Open
Conversation
1621e50 to
015d079
Compare
4ff1754 to
6e4a289
Compare
…allow a sequence of upgrades which can support promises returned by `addCallback` callbacks (and add docs and tests for multiple promise-based callbacks on different versions); Commenting: Indicate specific Safari bug within code; Refactoring: Use ES6 `Array.from`; add `Number.isInteger` and ES7 `Object.values()` in place of npm modules (requires babel-polyfill); Testing: Split off local testing from Sauce; prevent blocking; increase timeout for Firefox; add test to throw with previous version
…ted `addCallback` ones, can themselves use idb-schema methods (e.g., to convert from JSON to idb-schema) though, since they execute within `upgradeneeded` cannot support Promises (as can the callbacks within `addCallback` when `schema.open` or `schema.upgrade` are used); document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on top of the previous PR. Early callbacks will be run before the stores and indexes are added and deleted, allowing for such early callbacks to run idb-schema methods like
addStore. This is needed by theidb-importproject I am working on now, to allow specification of imports by JSON (without my needing to reinvent the wheel with your methods).It is also needed because the other PR allows normal callbacks to execute, as before, after the other methods, but in a way which supports promises--by having them run during the
successevent instead of duringupgradeneededwhenschema.openorschema.upgradeare used (it wouldn't make sense to use them inschema.callbacksince that is automatically going to be withinupgradeneeded); there should therefore also be a way to run a callback within theupgradeneededtransaction, e.g., to check the current object stores and conditionally add one if not present.