blob: 55c468ee93d9a0d8412f3fdf702a1d8a9adfcac3 [file] [log] [blame]
// @dart = 2.9
library async_periodictimer;
import 'dart:async';
import 'package:expect/minitest.dart';
main(message, replyTo) {
var command = message.first;
expect(command, 'START');
int counter = 0;
new Timer.periodic(const Duration(milliseconds: 10), (timer) {
if (counter == 3) {
counter = 1024;
timer.cancel();
// Wait some more time to be sure callback won't be invoked any
// more.
new Timer(const Duration(milliseconds: 30), () {
replyTo.send('DONE');
});
return;
}
assert(counter < 3);
counter++;
});
}