refactor(async): extract timer related functions into a TimerWrapper

This commit is contained in:
Victor Berchet
2015-05-19 16:47:30 +02:00
parent 62b1a08f06
commit 6ec5d5daaf
8 changed files with 51 additions and 51 deletions

View File

@ -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 {