Guest User

Untitled

a guest
Mar 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. /**
  2. * startWatching() is the top level function to begin
  3. * the contract event watching
  4. */
  5. async function startWatching() {
  6. let watching = true;
  7.  
  8. while (watching) {
  9. await watchEvents();
  10. wait(5000);
  11. }
  12. }
  13.  
  14. /**
  15. * wait() will consecutively wait corresponding time given
  16. * rather than putting the code to sleep
  17. *
  18. * @param ms {Int} Amount of ms to wait
  19. */
  20. function wait(ms){
  21. var start = new Date().getTime();
  22. var end = start;
  23.  
  24. while(end < start + ms) {
  25. end = new Date().getTime();
  26. }
  27. }
Add Comment
Please, Sign In to add comment