glitch-javascript-sdk 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +13 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +13 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/util/Storage.ts +26 -5
package/dist/esm/index.js
CHANGED
|
@@ -32106,26 +32106,34 @@ var Storage = /** @class */ (function () {
|
|
|
32106
32106
|
}
|
|
32107
32107
|
Storage.set = function (key, value) {
|
|
32108
32108
|
try {
|
|
32109
|
-
|
|
32109
|
+
var serializedValue = JSON.stringify(value);
|
|
32110
|
+
window.localStorage.setItem(key, serializedValue);
|
|
32110
32111
|
}
|
|
32111
32112
|
catch (e) {
|
|
32112
32113
|
try {
|
|
32113
|
-
|
|
32114
|
+
var serializedValue = JSON.stringify(value);
|
|
32115
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
32114
32116
|
}
|
|
32115
32117
|
catch (e) {
|
|
32118
|
+
//fallback
|
|
32116
32119
|
this.setCookie(key, value, 31);
|
|
32117
|
-
//fallback if set cookie fails
|
|
32118
32120
|
Storage.data[key] = value;
|
|
32119
32121
|
}
|
|
32120
32122
|
}
|
|
32121
32123
|
};
|
|
32122
32124
|
Storage.get = function (key) {
|
|
32123
32125
|
try {
|
|
32124
|
-
|
|
32126
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
32127
|
+
if (serializedValue !== null) {
|
|
32128
|
+
return JSON.parse(serializedValue);
|
|
32129
|
+
}
|
|
32125
32130
|
}
|
|
32126
32131
|
catch (e) {
|
|
32127
32132
|
try {
|
|
32128
|
-
|
|
32133
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
32134
|
+
if (serializedValue !== null) {
|
|
32135
|
+
return JSON.parse(serializedValue);
|
|
32136
|
+
}
|
|
32129
32137
|
}
|
|
32130
32138
|
catch (e) {
|
|
32131
32139
|
var value = Storage.getCookie(key);
|