Skip to content

Commit

Permalink
remove template function to make it compatible with old compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
rinick committed Jul 27, 2018
1 parent 5c43005 commit 5e96de5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/src/utils/promise_timeout.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
part of dslink.utils;

Future<T> awaitWithTimeout<T>(Future<T> future, int timeoutMs,
{Function onTimeout = null,
Function onSuccessAfterTimeout = null,
Function onErrorAfterTimeout = null}) {
Completer<T> completer = new Completer();
Future awaitWithTimeout(Future future, int timeoutMs,
{Function onTimeout: null,
Function onSuccessAfterTimeout: null,
Function onErrorAfterTimeout: null}) {
Completer completer = new Completer();

Timer timer = new Timer(new Duration(milliseconds: timeoutMs), () {
if (!completer.isCompleted) {
Expand All @@ -14,7 +14,7 @@ Future<T> awaitWithTimeout<T>(Future<T> future, int timeoutMs,
completer.completeError(new Exception('Future timeout before complete'));
}
});
future.then((T t) {
future.then((t) {
if (completer.isCompleted) {
if (onSuccessAfterTimeout != null) {
onSuccessAfterTimeout(t);
Expand Down

0 comments on commit 5e96de5

Please sign in to comment.