Add `monitorOption` function

pull/4595/head
awsr 2026-01-24 16:12:36 -08:00
parent 58347af998
commit 7fc18befc5
No known key found for this signature in database
3 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,7 @@ const jsConfig = defineConfig([
generateForever: 'readonly',
showContributors: 'readonly',
opts: 'writable',
monitorOption: 'readonly',
sortUIElements: 'readonly',
all_gallery_buttons: 'readonly',
selected_gallery_button: 'readonly',

View File

@ -1234,6 +1234,7 @@ async function initGallery() { // triggered on gradio change to monitor when ui
});
intersectionObserver.observe(el.folders);
monitorGalleries();
monitorOption('browser_gallery_advanced', updateGalleryAdvDisplay);
}
// register on startup

View File

@ -11,6 +11,10 @@ const monitoredOpts = [
{ sd_backend: () => gradioApp().getElementById('refresh_sd_model_checkpoint')?.click() },
];
function monitorOption(option, callback) {
monitoredOpts.push({ [option]: callback });
}
const AppyOpts = [
{ compact_view: (val, old) => toggleCompact(val, old) },
{ gradio_theme: (val, old) => setTheme(val, old) },