glitch-javascript-sdk 0.2.9 → 0.3.1
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 +16 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +16 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/util/Requests.ts +7 -1
- package/src/util/Storage.ts +26 -5
package/dist/cjs/index.js
CHANGED
|
@@ -15681,6 +15681,9 @@ var Requests = /** @class */ (function () {
|
|
|
15681
15681
|
var queryString = Object.entries(params)
|
|
15682
15682
|
.map(function (_a) {
|
|
15683
15683
|
var key = _a[0], value = _a[1];
|
|
15684
|
+
if (Array.isArray(value)) {
|
|
15685
|
+
return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
|
|
15686
|
+
}
|
|
15684
15687
|
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
15685
15688
|
})
|
|
15686
15689
|
.join('&');
|
|
@@ -17884,26 +17887,34 @@ var Storage = /** @class */ (function () {
|
|
|
17884
17887
|
}
|
|
17885
17888
|
Storage.set = function (key, value) {
|
|
17886
17889
|
try {
|
|
17887
|
-
|
|
17890
|
+
var serializedValue = JSON.stringify(value);
|
|
17891
|
+
window.localStorage.setItem(key, serializedValue);
|
|
17888
17892
|
}
|
|
17889
17893
|
catch (e) {
|
|
17890
17894
|
try {
|
|
17891
|
-
|
|
17895
|
+
var serializedValue = JSON.stringify(value);
|
|
17896
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
17892
17897
|
}
|
|
17893
17898
|
catch (e) {
|
|
17899
|
+
//fallback
|
|
17894
17900
|
this.setCookie(key, value, 31);
|
|
17895
|
-
//fallback if set cookie fails
|
|
17896
17901
|
Storage.data[key] = value;
|
|
17897
17902
|
}
|
|
17898
17903
|
}
|
|
17899
17904
|
};
|
|
17900
17905
|
Storage.get = function (key) {
|
|
17901
17906
|
try {
|
|
17902
|
-
|
|
17907
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
17908
|
+
if (serializedValue !== null) {
|
|
17909
|
+
return JSON.parse(serializedValue);
|
|
17910
|
+
}
|
|
17903
17911
|
}
|
|
17904
17912
|
catch (e) {
|
|
17905
17913
|
try {
|
|
17906
|
-
|
|
17914
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
17915
|
+
if (serializedValue !== null) {
|
|
17916
|
+
return JSON.parse(serializedValue);
|
|
17917
|
+
}
|
|
17907
17918
|
}
|
|
17908
17919
|
catch (e) {
|
|
17909
17920
|
var value = Storage.getCookie(key);
|