Comments (5)
when you say it's "not initializing", do you mean that it is throwing an error? or just that it is using fake storage? if it is the latter, then that is what's supposed to happen when localStorage
is not available. you can test it via store.isFake()
Regarding your fix, store
should always be an alias for store.local
, never store.session
. that's too confusing of a change to substitute sessionStorage when people are expecting local. i think it's better to stick with the fake. If you want your app to fall back to sessionStorage when localStorage is fake, then just add this test to your code:
if (store.isFake()) {
store = store.session;
}
But i don't think it's wise to do that by default. Alternatively, you could include the store.old.js extension which will try to replace localStorage with an IE userData polyfill when store.isFake()
from store.
Hi,
I'll add more details.
I got an error on line 201 with the following message: "This function is not supported on this system."
This is the line in question:
var store = window.store = _.Store('local', localStorage);
I verified that just reading localStorage threw that error. Interestingly checking the type of localStorage as such:
typeof(window.localStorage)
returned 'unknown', not 'undefined'. I am not sure, but this looks rather strange. I can only reproduce this problem on IE10 running in 32 bit mode via Selenium's IE proxy. When running IE10 normally (i.e. not via Selenium), localStorage works just as expected. I suspect it has something to do with unsufficient permissions for localStorage, but I am unable to verify that for sure. Anyway, it seems that IE10 can react in this way, and since we want to use store.js, we need to work around this.
Currently we are using a slightly modified version to ignore the missing localStorage, but it would be nicer to incorporate the change into the main branch, if you will.
from store.
Ah, an thrown error. Yes, i'll put a fix in the main branch. I think you are right that it is probably a permissions error, but i'm not set up to test IE10 32 bit. I'll have to let you test this for me and confirm the fix.
My preferred fix is to do a try/catch in an IIFE, as i do for sessionStorage (FF throws errors for sessionStorage when used in local filesystem). I'll push the change, when you test it and confirm the fix works, i'll tag a new release.
So you know, the fix will mean that store.isFake()
will return true
(data only survives while the page is up), but it should not give you any errors.
from store.
Ok, the purported fix is in the main branch, please let me know ASAP if it does the trick.
from store.
It works beautifully. Thank you!
from store.
Related Issues (20)
- TypeScript complains that area doesn't exists HOT 8
- 同学,您这个项目引入了319个开源组件,存在14个漏洞,辛苦升级一下 HOT 1
- Ability to change the delimiter? HOT 12
- this is literally a convoluted JSON.parse/JSON.stringify HOT 1
- Cache expires value always undefined HOT 5
- version 2.14.0 is not published to npm HOT 3
- expiration time HOT 1
- Bug: error TS2304: Cannot find name 'index' HOT 1
- Q: Is there any way to bypass JSON.stringfy on .set() HOT 4
- How to get the store namespace value? HOT 1
- How to write .d.ts for extension method(s)? HOT 1
- Is there anyway to obtain what storage I'm passing to the plugin? HOT 2
- How much capacity for storage? HOT 1
- _.replace does not get rich objects HOT 4
- Is this library MIT or GPL-3? HOT 1
- GPL-3 or MIT? HOT 5
- Error in each implementation HOT 3
- Question: Are browser native storage APIs supported? HOT 2
- TypeScript Definitions Issue HOT 21
- store怎么在vue3中使用? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store.