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

Additional Example #7

Closed
jimthedev opened this issue Apr 1, 2014 · 3 comments
Closed

Additional Example #7

jimthedev opened this issue Apr 1, 2014 · 3 comments

Comments

@jimthedev
Copy link

Hi there,

One super useful example might be, how to use a single database, but multiple stores.

The current example shows that database and store are set in the same config. If you had multiple stores inside of one database, it would be worthwhile to see how you could set the database at the app level, and set individual stores at the service level.

Is this something that'd be possible?

@ocombe
Copy link
Collaborator

ocombe commented Apr 1, 2014

I'm not entirely sure of what you mean ?
Localforage might use localstorage if indexedDB or webSQL ain't available, and localstorage only handles key-values.
My module will add a prefix to be sure that your data can be manipulated independently from other data (ie: you won't wipe other libs localstorage data).
If you need to store different things, use different keys.

If you are referring to the way indexedDB stores its data with a database, multiple tables with multiple keys in each, it is not possible because we need to make sure that it would work just the same for localstorage. Localforage will only use one database and one table (but multiple keys, of course).

@jimthedev
Copy link
Author

@ocombe Ok gotcha. I will just use keys instead. I thought maybe there was the potential to use one db but multiple tables but was wrong. Thanks for the help and this awesome project. One unrelated question, have you used a cache with this at all? Something similar to angular-cache or other cache projects?

@ocombe
Copy link
Collaborator

ocombe commented Apr 1, 2014

I haven't used any cache no, I think it should be something devs need to implement on their own because I don't know what their needs are :)
And thanks for the credit but most of the hard work has been done by @tofumatt in https://github.com/mozilla/localForage, this is (almost) just an angular wrapper :)

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

No branches or pull requests

2 participants