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

feat(setDriver): try the next driver if _initStorage fails #448

Merged
merged 6 commits into from
Sep 22, 2015

Conversation

thgreasi
Copy link
Member

Resolves #363
Possibly related to #70, #145, #195

Squashed commits :
feat(localforage.setDriver): try the first driver directly
feat(localforage.setDriver): wait for any pending older driver initialization
refactor(localforage.setDriver): remove the outer promise in favor of chaining
fix(localforage.setDriver): wrap LibaryMethods with ready()
refactor(localforage.ready): remove the outer promise in favor of chaining

feat(localforage.setDriver): try the first driver directly
feat(localforage.setDriver): wait for any pending older driver initialization
refactor(localforage.setDriver): remove the outer promise in favor of chaining
fix(localforage.setDriver): wrap LibaryMethods with ready()
refactor(localforage.ready): remove the outer promise in favor of chaining
callWhenReady(this, LibraryMethods[i]);
}

this._wrapLibraryMethodsWithReady();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstract into a separate method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@thgreasi thgreasi changed the title feat(localforage.setDriver): try the next driver if _initStorage fails feat(setDriver): try the next driver if _initStorage fails Sep 12, 2015
self._ready = null;
function initDriver(supportedDrivers) {
return function() {
var crntDriverPos = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to rename this to currentDriverPosition; we have the bytes to spare 😉

@tofumatt
Copy link
Member

Sorry this took me ages; I'm very behind on localForage work.

All good; I'll tweak that variable name and merge it in now 👍

@thgreasi
Copy link
Member Author

It took me a lot of time to write and some iterations & refactors to bring the code to its final state. So I guess that the time required for reviewing was expected given the complexity & effort.
It was great when I first tried it on an old version of Firefox in private mode and it worked by falling back to localStorage, after the first storage access!

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.

An InvalidStateError is throw in Firefox incognito
2 participants