mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-14 22:53:25 +03:00
22 lines
510 B
JavaScript
22 lines
510 B
JavaScript
function gradioApp(){
|
|
return document.getElementsByTagName('gradio-app')[0].shadowRoot;
|
|
}
|
|
|
|
uiUpdateCallbacks = []
|
|
function onUiUpdate(callback){
|
|
uiUpdateCallbacks.push(callback)
|
|
}
|
|
|
|
function uiUpdate(root){
|
|
uiUpdateCallbacks.forEach(function(x){
|
|
x()
|
|
})
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
var mutationObserver = new MutationObserver(function(m){
|
|
uiUpdate(gradioApp());
|
|
});
|
|
mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
|
|
});
|