Sebastiankay commited on
Commit
0d4e373
·
verified ·
1 Parent(s): 852a993

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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");},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
 
 
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