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/esm/index.js
CHANGED
|
@@ -29903,6 +29903,9 @@ var Requests = /** @class */ (function () {
|
|
|
29903
29903
|
var queryString = Object.entries(params)
|
|
29904
29904
|
.map(function (_a) {
|
|
29905
29905
|
var key = _a[0], value = _a[1];
|
|
29906
|
+
if (Array.isArray(value)) {
|
|
29907
|
+
return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
|
|
29908
|
+
}
|
|
29906
29909
|
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
29907
29910
|
})
|
|
29908
29911
|
.join('&');
|
|
@@ -32106,26 +32109,34 @@ var Storage = /** @class */ (function () {
|
|
|
32106
32109
|
}
|
|
32107
32110
|
Storage.set = function (key, value) {
|
|
32108
32111
|
try {
|
|
32109
|
-
|
|
32112
|
+
var serializedValue = JSON.stringify(value);
|
|
32113
|
+
window.localStorage.setItem(key, serializedValue);
|
|
32110
32114
|
}
|
|
32111
32115
|
catch (e) {
|
|
32112
32116
|
try {
|
|
32113
|
-
|
|
32117
|
+
var serializedValue = JSON.stringify(value);
|
|
32118
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
32114
32119
|
}
|
|
32115
32120
|
catch (e) {
|
|
32121
|
+
//fallback
|
|
32116
32122
|
this.setCookie(key, value, 31);
|
|
32117
|
-
//fallback if set cookie fails
|
|
32118
32123
|
Storage.data[key] = value;
|
|
32119
32124
|
}
|
|
32120
32125
|
}
|
|
32121
32126
|
};
|
|
32122
32127
|
Storage.get = function (key) {
|
|
32123
32128
|
try {
|
|
32124
|
-
|
|
32129
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
32130
|
+
if (serializedValue !== null) {
|
|
32131
|
+
return JSON.parse(serializedValue);
|
|
32132
|
+
}
|
|
32125
32133
|
}
|
|
32126
32134
|
catch (e) {
|
|
32127
32135
|
try {
|
|
32128
|
-
|
|
32136
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
32137
|
+
if (serializedValue !== null) {
|
|
32138
|
+
return JSON.parse(serializedValue);
|
|
32139
|
+
}
|
|
32129
32140
|
}
|
|
32130
32141
|
catch (e) {
|
|
32131
32142
|
var value = Storage.getCookie(key);
|