mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
@@ -65,6 +65,7 @@ function onOptionsChanged(callback) {
|
||||
function executeCallbacks(queue, arg) {
|
||||
// if (!uiLoaded) return
|
||||
for (const callback of queue) {
|
||||
if (!callback) continue;
|
||||
try {
|
||||
callback(arg);
|
||||
} catch (e) {
|
||||
|
||||
@@ -26,7 +26,7 @@ async function updateOpts(json_string) {
|
||||
const key = Object.keys(op)[0];
|
||||
const callback = op[key];
|
||||
if (opts[key] && opts[key] !== settings_data.values[key]) {
|
||||
log('updateOpts', key, opts[key], settings_data.values[key]);
|
||||
log('updateOpt', key, opts[key], settings_data.values[key]);
|
||||
if (callback) callback(new_opts[key], opts[key]);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,8 @@ async function updateOpts(json_string) {
|
||||
if (callback) callback(new_opts[key], opts[key]);
|
||||
}
|
||||
|
||||
opts = new_opts;
|
||||
window.opts = new_opts;
|
||||
log('updateOpts', Object.keys(new_opts).length);
|
||||
Object.entries(opts_metadata).forEach(([opt, meta]) => {
|
||||
if (!opts_tabs[meta.tab_name]) opts_tabs[meta.tab_name] = {};
|
||||
if (!opts_tabs[meta.tab_name].unsaved_keys) opts_tabs[meta.tab_name].unsaved_keys = new Set();
|
||||
|
||||
@@ -3,6 +3,7 @@ window.api = '/sdapi/v1';
|
||||
window.subpath = '';
|
||||
|
||||
async function initStartup() {
|
||||
const t0 = performance.now();
|
||||
log('initStartup');
|
||||
if (window.setupLogger) await setupLogger();
|
||||
|
||||
@@ -24,7 +25,11 @@ async function initStartup() {
|
||||
await reconnectUI();
|
||||
|
||||
// make sure all of the ui is ready and options are loaded
|
||||
while (Object.keys(window.opts).length === 0) await sleep(50);
|
||||
let t1 = performance.now();
|
||||
while ((Object.keys(window.opts).length === 0) && (t1 - t0 < 10000)) {
|
||||
t1 = performance.now();
|
||||
await sleep(50);
|
||||
}
|
||||
log('mountURL', window.opts.subpath);
|
||||
if (window.opts.subpath?.length > 0) {
|
||||
window.subpath = window.opts.subpath;
|
||||
@@ -43,6 +48,8 @@ async function initStartup() {
|
||||
setHints();
|
||||
applyStyles();
|
||||
initIndexDB();
|
||||
t1 = performance.now();
|
||||
log('initStartup', Math.round(1000 * (t1 - t0) / 1000000));
|
||||
}
|
||||
|
||||
onUiLoaded(initStartup);
|
||||
|
||||
Reference in New Issue
Block a user