简体   繁体   中英

Repeat function when finished with Javascript?

Is it possible to repeat a function when it has finished. For Example: I have a Datatable with the following input data:

Name  |  Birthday | Checked
Test1   20.3.2000   Null
Test1   20.3.2001   Null  
Test1   20.3.2002   Null

Now i want the function to Take the first Line where Checked == Null Write something to another table and mark Checked = true After the first call it would be

Name  |  Birthday | Checked
Test1   20.3.2000   True
Test1   20.3.2001   Null  
Test1   20.3.2002   Null

After the second Call

Name  |  Birthday | Checked
Test1   20.3.2000   True
Test1   20.3.2001   True  
Test1   20.3.2002   Null

After the third Call

Name  |  Birthday | Checked
Test1   20.3.2000   True
Test1   20.3.2001   True  
Test1   20.3.2002   True

Data in the table may be manipulated while a call the method so count(*) on Checked while not work as a line may be added inbetween.

The Basic question ist. How can I call a function repeadetly, not with a given interval but after the previous call has completed?

Following code

setTimeout(function, 1000);

Was working in my case. I do not have to wait for the function to finish as the other function cannot access the db before it is finished.

Thx for the input.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM