refactor(async): extract timer related functions into a TimerWrapper
This commit is contained in:
@ -29,7 +29,12 @@ class PromiseWrapper {
|
||||
|
||||
static CompleterWrapper completer() => new CompleterWrapper(new Completer());
|
||||
|
||||
// TODO(vic): create a TimerWrapper
|
||||
static bool isPromise(maybePromise) {
|
||||
return maybePromise is Future;
|
||||
}
|
||||
}
|
||||
|
||||
class TimerWrapper {
|
||||
static Timer setTimeout(fn(), int millis)
|
||||
=> new Timer(new Duration(milliseconds: millis), fn);
|
||||
static void clearTimeout(Timer timer) {
|
||||
@ -43,10 +48,6 @@ class PromiseWrapper {
|
||||
static void clearInterval(Timer timer) {
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
static bool isPromise(maybePromise) {
|
||||
return maybePromise is Future;
|
||||
}
|
||||
}
|
||||
|
||||
class ObservableWrapper {
|
||||
|
Reference in New Issue
Block a user