web-manager 3.1.20 → 3.1.21
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +1 -1
- package/lib/storage.js +8 -16
- package/package.json +2 -2
package/index.js
CHANGED
package/lib/storage.js
CHANGED
@@ -2,50 +2,42 @@
|
|
2
2
|
*/
|
3
3
|
var utilities = require('./utilities.js');
|
4
4
|
var support;
|
5
|
+
var pseudoStorage = {};
|
5
6
|
|
6
7
|
function Storage(storageObj) {
|
7
8
|
this.storage = storageObj;
|
8
9
|
}
|
9
10
|
|
10
11
|
Storage.get = function(path, def, options) {
|
11
|
-
var result;
|
12
12
|
path = path || '';
|
13
|
-
|
13
|
+
|
14
14
|
try {
|
15
|
-
|
16
|
-
result = utilities.get(JSON.parse(window.localStorage.getItem('_manager')) || {}, path, def);
|
15
|
+
return utilities.get(JSON.parse(window.localStorage.getItem('_manager')) || {}, path, def);
|
17
16
|
} catch (e) {
|
18
|
-
|
17
|
+
return utilities.get(pseudoStorage, path, def)
|
19
18
|
}
|
20
|
-
return result;
|
21
19
|
}
|
22
20
|
|
23
21
|
Storage.set = function(path, value, options) {
|
24
|
-
// if (typeof Storage !== 'undefined') { return };
|
25
22
|
var existing;
|
23
|
+
|
26
24
|
try {
|
27
25
|
existing = Storage.get('', {});
|
28
26
|
utilities.set(existing, path, value);
|
29
27
|
window.localStorage.setItem('_manager', JSON.stringify(existing));
|
30
28
|
} catch (e) {
|
31
|
-
|
29
|
+
utilities.set(pseudoStorage, path, value)
|
32
30
|
}
|
31
|
+
|
33
32
|
return existing;
|
34
33
|
}
|
35
34
|
|
36
35
|
Storage.clear = function(options) {
|
37
|
-
// options = options || {};
|
38
|
-
// options.type = options.type || 'manager';
|
39
|
-
// if (typeof Storage !== 'undefined') { return };
|
40
|
-
// if (options.type == 'manager') {
|
41
36
|
try {
|
42
37
|
window.localStorage.setItem('_manager', '{}');
|
43
38
|
} catch (e) {
|
44
|
-
|
39
|
+
pseudoStorage = {};
|
45
40
|
}
|
46
|
-
// } else {
|
47
|
-
// window.localStorage.clear();
|
48
|
-
// }
|
49
41
|
}
|
50
42
|
|
51
43
|
module.exports = Storage;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.21",
|
4
4
|
"description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -28,4 +28,4 @@
|
|
28
28
|
"firebase": "^8.10.1",
|
29
29
|
"lazysizes": "^5.3.2"
|
30
30
|
}
|
31
|
-
}
|
31
|
+
}
|