-
-
Notifications
You must be signed in to change notification settings - Fork 40
Update index.js #19
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
Update index.js #19
Conversation
| try { | ||
| store = typeof window !== 'undefined' && v in window ? window[v] : undefined; | ||
| } catch (e) { console.log(v + ' error: ' + e) } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
| if (store) return; | ||
| try { | ||
| store = typeof window !== 'undefined' && v in window ? window[v] : undefined; | ||
| } catch (e) { console.log(v + ' error: ' + e) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
| ? window.localStorage | ||
| : Memory; | ||
| let store; | ||
| ['localStorage', 'sessionStorage'].forEach( v => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
| const store = typeof window !== 'undefined' && 'localStorage' in window | ||
| ? window.localStorage | ||
| : Memory; | ||
| let store; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
1 similar comment
|
thanks |
In some cases IE10-11 protected mode gives error "Access denied" when localStorage is accessed. Fallback is sessionStorage and then Memory.