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/cjs/index.js
CHANGED
|
@@ -17884,26 +17884,34 @@ var Storage = /** @class */ (function () {
|
|
|
17884
17884
|
}
|
|
17885
17885
|
Storage.set = function (key, value) {
|
|
17886
17886
|
try {
|
|
17887
|
-
|
|
17887
|
+
var serializedValue = JSON.stringify(value);
|
|
17888
|
+
window.localStorage.setItem(key, serializedValue);
|
|
17888
17889
|
}
|
|
17889
17890
|
catch (e) {
|
|
17890
17891
|
try {
|
|
17891
|
-
|
|
17892
|
+
var serializedValue = JSON.stringify(value);
|
|
17893
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
17892
17894
|
}
|
|
17893
17895
|
catch (e) {
|
|
17896
|
+
//fallback
|
|
17894
17897
|
this.setCookie(key, value, 31);
|
|
17895
|
-
//fallback if set cookie fails
|
|
17896
17898
|
Storage.data[key] = value;
|
|
17897
17899
|
}
|
|
17898
17900
|
}
|
|
17899
17901
|
};
|
|
17900
17902
|
Storage.get = function (key) {
|
|
17901
17903
|
try {
|
|
17902
|
-
|
|
17904
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
17905
|
+
if (serializedValue !== null) {
|
|
17906
|
+
return JSON.parse(serializedValue);
|
|
17907
|
+
}
|
|
17903
17908
|
}
|
|
17904
17909
|
catch (e) {
|
|
17905
17910
|
try {
|
|
17906
|
-
|
|
17911
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
17912
|
+
if (serializedValue !== null) {
|
|
17913
|
+
return JSON.parse(serializedValue);
|
|
17914
|
+
}
|
|
17907
17915
|
}
|
|
17908
17916
|
catch (e) {
|
|
17909
17917
|
var value = Storage.getCookie(key);
|