Update app.py
Browse files
app.py
CHANGED
@@ -264,23 +264,23 @@ theme = gr.themes.Soft(
|
|
264 |
|
265 |
js_test = """
|
266 |
// Call the below function
|
267 |
-
waitForElementToDisplay("#component-153",function(){alert("Hi")
|
268 |
|
269 |
function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
|
270 |
-
var startTimeInMs = Date.now()
|
271 |
(function loopSearch() {
|
272 |
if (document.querySelector(selector) != null) {
|
273 |
-
callback()
|
274 |
-
return
|
275 |
}
|
276 |
else {
|
277 |
setTimeout(function () {
|
278 |
if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs)
|
279 |
-
return
|
280 |
-
loopSearch()
|
281 |
-
}, checkFrequencyInMs)
|
282 |
}
|
283 |
-
})()
|
284 |
}
|
285 |
"""
|
286 |
|
|
|
264 |
|
265 |
js_test = """
|
266 |
// Call the below function
|
267 |
+
waitForElementToDisplay("#component-153",function(){alert("Hi")},1000,9000)
|
268 |
|
269 |
function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
|
270 |
+
var startTimeInMs = Date.now()
|
271 |
(function loopSearch() {
|
272 |
if (document.querySelector(selector) != null) {
|
273 |
+
callback()
|
274 |
+
return
|
275 |
}
|
276 |
else {
|
277 |
setTimeout(function () {
|
278 |
if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs)
|
279 |
+
return
|
280 |
+
loopSearch()
|
281 |
+
}, checkFrequencyInMs)
|
282 |
}
|
283 |
+
})()
|
284 |
}
|
285 |
"""
|
286 |
|