Use onAfterUiUpdate where possible

This commit is contained in:
Aarni Koskela 2023-05-25 09:09:13 +03:00
parent bc53ecf298
commit dc7a1bbb1c
7 changed files with 7 additions and 9 deletions

View File

@ -81,7 +81,7 @@ function dimensionChange(e, is_width, is_height) {
}
onUiUpdate(function() {
onAfterUiUpdate(function() {
var arPreviewRect = gradioApp().querySelector('#imageARPreview');
if (arPreviewRect) {
arPreviewRect.style.display = 'none';

View File

@ -167,6 +167,4 @@ var addContextMenuEventListener = initResponse[2];
})();
//End example Context Menu Items
onUiUpdate(function() {
addContextMenuEventListener();
});
onAfterUiUpdate(addContextMenuEventListener);

View File

@ -1,7 +1,7 @@
// attaches listeners to the txt2img and img2img galleries to update displayed generation param text when the image changes
let txt2img_gallery, img2img_gallery, modal = undefined;
onUiUpdate(function() {
onAfterUiUpdate(function() {
if (!txt2img_gallery) {
txt2img_gallery = attachGalleryListeners("txt2img");
}

View File

@ -39,5 +39,5 @@ function imageMaskResize() {
});
}
onUiUpdate(imageMaskResize);
onAfterUiUpdate(imageMaskResize);
window.addEventListener('resize', imageMaskResize);

View File

@ -170,7 +170,7 @@ function modalTileImageToggle(event) {
event.stopPropagation();
}
onUiUpdate(function() {
onAfterUiUpdate(function() {
var fullImg_preview = gradioApp().querySelectorAll('.gradio-gallery > div > img');
if (fullImg_preview != null) {
fullImg_preview.forEach(setupImageForLightbox);

View File

@ -4,7 +4,7 @@ let lastHeadImg = null;
let notificationButton = null;
onUiUpdate(function() {
onAfterUiUpdate(function() {
if (notificationButton == null) {
notificationButton = gradioApp().getElementById('request_notifications');

View File

@ -249,7 +249,7 @@ function confirm_clear_prompt(prompt, negative_prompt) {
var opts = {};
onUiUpdate(function() {
onAfterUiUpdate(function() {
if (Object.keys(opts).length != 0) return;
var json_elem = gradioApp().getElementById('settings_json');