Skip to content

Commit bcba8a6

Browse files
committed
Better localStorage support detection.
In IE9 when file is opened from local filesystem the localStorage property of window exists, but is undefined.
1 parent d249043 commit bcba8a6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

template/app/LocalStore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Ext.define("Docs.LocalStore", {
1313
* localStorage available.
1414
*/
1515
init: function() {
16-
this.localStorage = ('localStorage' in window && window['localStorage'] !== null);
16+
this.localStorage = !!window['localStorage'];
1717
this.store = Ext.getStore(this.storeName);
1818

1919
if (this.localStorage) {

template/app/model/Setting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Ext.define('Docs.model.Setting', {
55
fields: ['id', 'key', 'value'],
66
extend: 'Ext.data.Model',
77
proxy: {
8-
type: ('localStorage' in window && window['localStorage'] !== null) ? 'localstorage' : 'memory',
8+
type: window['localStorage'] ? 'localstorage' : 'memory',
99
id: Docs.localStorageDb + '-settings'
1010
}
1111
});

0 commit comments

Comments
 (0)