mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
ui init error handler
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
Submodule extensions-builtin/sdnext-modernui updated: 23af15ecd7...753ee8d3ef
@@ -1270,11 +1270,12 @@ async function initGalleryAutoRefresh() {
|
||||
let galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery');
|
||||
let timeout = 0;
|
||||
while (!galleryTab && timeout++ < 60) {
|
||||
await new Promise((resolve) => { setTimeout(resolve, 1000); });
|
||||
await new Promise((resolve) => { setTimeout(resolve, 2500); });
|
||||
galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery');
|
||||
}
|
||||
if (!galleryTab) {
|
||||
throw new Error('Timed out waiting for gallery tab element');
|
||||
error('Gallery: timeout');
|
||||
return;
|
||||
}
|
||||
const displayNoneRegEx = /display:\s*none/;
|
||||
async function galleryAutoRefresh(mutations) {
|
||||
|
||||
@@ -9,15 +9,10 @@ function gradioApp() {
|
||||
return elem.shadowRoot ? elem.shadowRoot : elem;
|
||||
}
|
||||
|
||||
function logFn(func) {
|
||||
return async (...args) => {
|
||||
function logFn(func) { // not recommended: use log, debug or error explicitly
|
||||
return async function () { // eslint-disable-line func-names
|
||||
const t0 = performance.now();
|
||||
let returnValue;
|
||||
if (func.constructor.name.toLowerCase() === 'asyncfunction') {
|
||||
returnValue = await func(...args);
|
||||
} else {
|
||||
returnValue = func(...args);
|
||||
}
|
||||
const returnValue = func(...arguments);
|
||||
const t1 = performance.now();
|
||||
log(func.name, `time=${Math.round(t1 - t0)}`);
|
||||
return returnValue;
|
||||
|
||||
Reference in New Issue
Block a user