Skip to content

Commit 80ece8e

Browse files
authored
Merge pull request #59 from IOT-DSA/features/timeout_ws_connection
remove template function to make it compatible with old compiler
2 parents 3f3769a + 5e96de5 commit 80ece8e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/src/utils/promise_timeout.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
part of dslink.utils;
22

3-
Future<T> awaitWithTimeout<T>(Future<T> future, int timeoutMs,
4-
{Function onTimeout = null,
5-
Function onSuccessAfterTimeout = null,
6-
Function onErrorAfterTimeout = null}) {
7-
Completer<T> completer = new Completer();
3+
Future awaitWithTimeout(Future future, int timeoutMs,
4+
{Function onTimeout: null,
5+
Function onSuccessAfterTimeout: null,
6+
Function onErrorAfterTimeout: null}) {
7+
Completer completer = new Completer();
88

99
Timer timer = new Timer(new Duration(milliseconds: timeoutMs), () {
1010
if (!completer.isCompleted) {
@@ -14,7 +14,7 @@ Future<T> awaitWithTimeout<T>(Future<T> future, int timeoutMs,
1414
completer.completeError(new Exception('Future timeout before complete'));
1515
}
1616
});
17-
future.then((T t) {
17+
future.then((t) {
1818
if (completer.isCompleted) {
1919
if (onSuccessAfterTimeout != null) {
2020
onSuccessAfterTimeout(t);

0 commit comments

Comments
 (0)