code: function waitAll() {
      return new Promise(function (resolved) {
          if (currentCount === 0 && remainedTasks.length === 0) {
              resolved();
          } else {
              waitAllCallbacks.push(resolved);
          }
      });
  }
docs: /*
  Wait all processes are finished