Guest User

Untitled

a guest
Dec 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Packets percent
  2. abc 10%
  3. efs 13%
  4.  
  5. var wait = function(condFunc, readyFunc, checkInterval) {
  6. var checkFunc = function() {
  7. if(condFunc()) {
  8. readyFunc();
  9. }
  10. else
  11. {
  12. setTimeout(checkFunc, checkInterval);
  13. }
  14. };
  15. checkFunc();
  16. };
  17.  
  18. wait(
  19. function() { return new Date().getSeconds() == 10; },
  20. function() { console.log("Done"); },
  21. 100
  22. );
  23.  
  24. function progress() {
  25. el = this;
  26. $.get("/path/to/rest/call", function(data) {
  27. el.textContent = data + "%";
  28. // define conditions for next request
  29. if (data < 100 /* conditions */) {
  30. progress.call(el)
  31. }
  32. })
  33. }
  34.  
  35. $("table tr").each(function() {
  36. progress.call(this)
  37. })
Add Comment
Please, Sign In to add comment