setTimeout method

  1. @VoltronMethod(kFuncSetTimeout)
bool setTimeout(
  1. int timeOut,
  2. String callId,
  3. JSPromise promise
)

Implementation

@VoltronMethod(kFuncSetTimeout)
bool setTimeout(int timeOut, String callId, JSPromise promise) {
  var timer = TimerTask(timeOut, false, callId, (task) {
    promise.resolve("");
    _timeInfo.remove(task);
  });
  _timeInfo[callId] = timer;
  timer.start();
  return true;
}