code: function wait() {
          var isDone = false;
          var start = new Date().getTime();
  
          var interval = setInterval(() => {
              var now = new Date().getTime();
              if ((now - start) >= _retryInterval){
                  clearInterval(interval);
                  isDone = true;
              }
          }, 50);
  
          deasync.loopWhile(() => !isDone);
      }
docs: wait synchronously in a non-blocking manner