@klauswuestefeld/jux-web 2024.9.9 → 2024.10.29
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/jux-web.js +15 -1
- package/dist/main.esm.js +15 -1
- package/dist/main.js +15 -1
- package/package.json +1 -1
package/dist/jux-web.js
CHANGED
|
@@ -194,6 +194,7 @@ var juxWeb = (function (exports) {
|
|
|
194
194
|
let requestRunning = false;
|
|
195
195
|
const maxRetries = 20;
|
|
196
196
|
let timeout = 20000;
|
|
197
|
+
const slowRequestTimeout = 2000;
|
|
197
198
|
// @ts-ignore
|
|
198
199
|
window.setRequestTimeout = (newTimeout) => timeout = newTimeout;
|
|
199
200
|
const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter$2(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
|
|
@@ -215,6 +216,13 @@ var juxWeb = (function (exports) {
|
|
|
215
216
|
if (requestType === 'query') {
|
|
216
217
|
timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
|
|
217
218
|
}
|
|
219
|
+
let isSlowRequest = false;
|
|
220
|
+
const slowRequestTimeoutId = setTimeout(() => {
|
|
221
|
+
isSlowRequest = true;
|
|
222
|
+
const requestUrl = new URL(url);
|
|
223
|
+
const event = new CustomEvent('slow-request', { detail: requestUrl.pathname, bubbles: true });
|
|
224
|
+
window.dispatchEvent(event);
|
|
225
|
+
}, slowRequestTimeout);
|
|
218
226
|
const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
|
|
219
227
|
if (onRedirect)
|
|
220
228
|
requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
|
|
@@ -252,6 +260,12 @@ var juxWeb = (function (exports) {
|
|
|
252
260
|
}
|
|
253
261
|
finally {
|
|
254
262
|
clearTimeout(timeoutId);
|
|
263
|
+
clearTimeout(slowRequestTimeoutId);
|
|
264
|
+
if (isSlowRequest) {
|
|
265
|
+
const requestUrl = new URL(url);
|
|
266
|
+
const event = new CustomEvent('slow-request-completed', { detail: requestUrl.pathname, bubbles: true });
|
|
267
|
+
window.dispatchEvent(event);
|
|
268
|
+
}
|
|
255
269
|
}
|
|
256
270
|
removeOverlay();
|
|
257
271
|
if (onRedirect)
|
|
@@ -276,7 +290,7 @@ var juxWeb = (function (exports) {
|
|
|
276
290
|
}
|
|
277
291
|
else {
|
|
278
292
|
// backend exceptions
|
|
279
|
-
onError(jsonResponse
|
|
293
|
+
onError(jsonResponse);
|
|
280
294
|
}
|
|
281
295
|
}
|
|
282
296
|
catch (err) {
|
package/dist/main.esm.js
CHANGED
|
@@ -193,6 +193,7 @@ const defaultHandleUnauthorized = () => {
|
|
|
193
193
|
let requestRunning = false;
|
|
194
194
|
const maxRetries = 20;
|
|
195
195
|
let timeout = 20000;
|
|
196
|
+
const slowRequestTimeout = 2000;
|
|
196
197
|
// @ts-ignore
|
|
197
198
|
window.setRequestTimeout = (newTimeout) => timeout = newTimeout;
|
|
198
199
|
const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
|
|
@@ -214,6 +215,13 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
214
215
|
if (requestType === 'query') {
|
|
215
216
|
timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
|
|
216
217
|
}
|
|
218
|
+
let isSlowRequest = false;
|
|
219
|
+
const slowRequestTimeoutId = setTimeout(() => {
|
|
220
|
+
isSlowRequest = true;
|
|
221
|
+
const requestUrl = new URL(url);
|
|
222
|
+
const event = new CustomEvent('slow-request', { detail: requestUrl.pathname, bubbles: true });
|
|
223
|
+
window.dispatchEvent(event);
|
|
224
|
+
}, slowRequestTimeout);
|
|
217
225
|
const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
|
|
218
226
|
if (onRedirect)
|
|
219
227
|
requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
|
|
@@ -251,6 +259,12 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
251
259
|
}
|
|
252
260
|
finally {
|
|
253
261
|
clearTimeout(timeoutId);
|
|
262
|
+
clearTimeout(slowRequestTimeoutId);
|
|
263
|
+
if (isSlowRequest) {
|
|
264
|
+
const requestUrl = new URL(url);
|
|
265
|
+
const event = new CustomEvent('slow-request-completed', { detail: requestUrl.pathname, bubbles: true });
|
|
266
|
+
window.dispatchEvent(event);
|
|
267
|
+
}
|
|
254
268
|
}
|
|
255
269
|
removeOverlay();
|
|
256
270
|
if (onRedirect)
|
|
@@ -275,7 +289,7 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
275
289
|
}
|
|
276
290
|
else {
|
|
277
291
|
// backend exceptions
|
|
278
|
-
onError(jsonResponse
|
|
292
|
+
onError(jsonResponse);
|
|
279
293
|
}
|
|
280
294
|
}
|
|
281
295
|
catch (err) {
|
package/dist/main.js
CHANGED
|
@@ -217,6 +217,7 @@ const defaultHandleUnauthorized = () => {
|
|
|
217
217
|
let requestRunning = false;
|
|
218
218
|
const maxRetries = 20;
|
|
219
219
|
let timeout = 20000;
|
|
220
|
+
const slowRequestTimeout = 2000;
|
|
220
221
|
// @ts-ignore
|
|
221
222
|
window.setRequestTimeout = (newTimeout) => timeout = newTimeout;
|
|
222
223
|
const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
|
|
@@ -238,6 +239,13 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
238
239
|
if (requestType === 'query') {
|
|
239
240
|
timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
|
|
240
241
|
}
|
|
242
|
+
let isSlowRequest = false;
|
|
243
|
+
const slowRequestTimeoutId = setTimeout(() => {
|
|
244
|
+
isSlowRequest = true;
|
|
245
|
+
const requestUrl = new URL(url);
|
|
246
|
+
const event = new CustomEvent('slow-request', { detail: requestUrl.pathname, bubbles: true });
|
|
247
|
+
window.dispatchEvent(event);
|
|
248
|
+
}, slowRequestTimeout);
|
|
241
249
|
const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
|
|
242
250
|
if (onRedirect)
|
|
243
251
|
requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
|
|
@@ -275,6 +283,12 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
275
283
|
}
|
|
276
284
|
finally {
|
|
277
285
|
clearTimeout(timeoutId);
|
|
286
|
+
clearTimeout(slowRequestTimeoutId);
|
|
287
|
+
if (isSlowRequest) {
|
|
288
|
+
const requestUrl = new URL(url);
|
|
289
|
+
const event = new CustomEvent('slow-request-completed', { detail: requestUrl.pathname, bubbles: true });
|
|
290
|
+
window.dispatchEvent(event);
|
|
291
|
+
}
|
|
278
292
|
}
|
|
279
293
|
removeOverlay();
|
|
280
294
|
if (onRedirect)
|
|
@@ -299,7 +313,7 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
|
|
|
299
313
|
}
|
|
300
314
|
else {
|
|
301
315
|
// backend exceptions
|
|
302
|
-
onError(jsonResponse
|
|
316
|
+
onError(jsonResponse);
|
|
303
317
|
}
|
|
304
318
|
}
|
|
305
319
|
catch (err) {
|