Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let monitor = await Service.monitor(session,taskId);
- let percent = JSON.parse(monitor).result[0].data.percent;
- let tryCount = 0;
- let tryMax = 10;
- while (percent < 100 || tryCount < tryMax) {
- setTimeout(function() {
- let percent = JSON.parse(monitor).result[0].data.percent;
- tryCount++;
- }, 5000);
- console.log('in a while loop ',tryCount, percent);
- if(tryCount == 10){
- var err = new Error('Error')
- throw err
- }
- }
- in a while loop 0 0
- in a while loop 0 0
- ...
- in a while loop 0 0
- in a while loop 0 0
Add Comment
Please, Sign In to add comment