-
Notifications
You must be signed in to change notification settings - Fork 156
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
offer option to store data at localstorage #26
Comments
What is your use case? How would you expect angular-cache to behave if the browser doesn't support localStorage? |
I'm writing hybrid app which support localstorage.
|
my use case is :
|
Sounds reasonable enough, and local storage isn't actually that much code. How would you expect angular-cache to behave if a user hits your app in a browser that doesn't support local storage? |
I don't care about that... because my use case is mobile app, it's well support ( http://caniuse.com/#feat=namevalue-storage). If browser doesn't support, then just using current memory cache or just offer some interface for developers to provide a special cache factory. |
Alright, this weekend I should have some time to work on this. If the browser doesn't support localStorage then I'll let the dev provide a localStorage polyfill to angular-cache, or rely on in-memory storage only. |
|
Finished localStorage implementation. Now for some tests. Added some tests to the localStorage feature. Finished unit tests for localStorage feature. Updated coverage.
@atian25 I've got the implementation done and the unit tests written. If you'd like, I would appreciate it if you tried out the version of angular-cache in the Usage: $angularCacheFactory('myCache', { storageMode: 'localStorage' }); Note It's the developer's responsibility to provide a polyfill for the global |
thanks for your work! I will try out it. another new question: this issue due to a bad news: one of my workmate, he said there's some so if it is true, I'm afraid we had to write a java interface to provide a specail storageMode, then export it to a javascript interface |
after a quick code review, could we just set |
I will allow the following: $angularCacheFactory('newCache', {
storageMode: 'localStorage',
localStorage: myLocalStorageImpl // Can be set to your own localStorage. Defaults to window.localStorage
sessionStorage: mySessionStorageImpl // Can be set to your own sessionStorage. Defaults to window.sessionStorage
}); Your implementations will of course have to implement to same interface as the global I will work on it tomorrow, as it is bedtime here. |
No description provided.
The text was updated successfully, but these errors were encountered: