| Index: packages/quiver/lib/src/async/countdown_timer.dart
|
| diff --git a/packages/quiver/lib/src/async/countdown_timer.dart b/packages/quiver/lib/src/async/countdown_timer.dart
|
| index cd052e7766be9afd22ac7ecd5bc95a0ad17f62df..6e17c84432e70be850a8163e7aee055b67ab3963 100644
|
| --- a/packages/quiver/lib/src/async/countdown_timer.dart
|
| +++ b/packages/quiver/lib/src/async/countdown_timer.dart
|
| @@ -14,36 +14,35 @@
|
|
|
| part of quiver.async;
|
|
|
| -/**
|
| - * A simple countdown timer that fires events in regular increments until a
|
| - * duration has passed.
|
| - *
|
| - * CountdownTimer implements [Stream] and sends itself as the event. From the
|
| - * timer you can get the [remaining] and [elapsed] time, or [cancel] the timer.
|
| - */
|
| +/// A simple countdown timer that fires events in regular increments until a
|
| +/// duration has passed.
|
| +///
|
| +/// CountdownTimer implements [Stream] and sends itself as the event. From the
|
| +/// timer you can get the [remaining] and [elapsed] time, or [cancel] the
|
| +/// timer.
|
| class CountdownTimer extends Stream<CountdownTimer> {
|
| static const _THRESHOLD_MS = 4;
|
|
|
| final Duration _duration;
|
| - final Duration _increment;
|
| final Stopwatch _stopwatch;
|
| +
|
| + /// The duration between timer events.
|
| + final Duration increment;
|
| final StreamController<CountdownTimer> _controller;
|
| Timer _timer;
|
|
|
| - /**
|
| - * Creates a new [CountdownTimer] that fires events in increments of
|
| - * [increment], until the [duration] has passed.
|
| - *
|
| - * [stopwatch] is for testing purposes. If you're using CountdownTimer and
|
| - * need to control time in a test, pass a mock or a fake. See [FakeAsync] and
|
| - * [FakeStopwatch].
|
| - */
|
| + /// Creates a new [CountdownTimer] that fires events in increments of
|
| + /// [increment], until the [duration] has passed.
|
| + ///
|
| + /// [stopwatch] is for testing purposes. If you're using CountdownTimer and
|
| + /// need to control time in a test, pass a mock or a fake. See [FakeAsync]
|
| + /// and [FakeStopwatch].
|
| CountdownTimer(Duration duration, Duration increment, {Stopwatch stopwatch})
|
| : _duration = duration,
|
| - _increment = increment,
|
| + increment = increment,
|
| _stopwatch = stopwatch == null ? new Stopwatch() : stopwatch,
|
| - _controller = new StreamController<CountdownTimer>.broadcast(
|
| - sync: true) {
|
| + _controller =
|
| + new StreamController<CountdownTimer>.broadcast(sync: true) {
|
| _timer = new Timer.periodic(increment, _tick);
|
| _stopwatch.start();
|
| }
|
|
|