Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: lib/src/restartable_timer.dart

Issue 1777453002: Modernize the package's style. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library async.restartable_timer;
6
7 import 'dart:async'; 5 import 'dart:async';
8 6
9 /// A non-periodic timer that can be restarted any number of times. 7 /// A non-periodic timer that can be restarted any number of times.
10 /// 8 ///
11 /// Once restarted (via [reset]), the timer counts down from its original 9 /// Once restarted (via [reset]), the timer counts down from its original
12 /// duration again. 10 /// duration again.
13 class RestartableTimer implements Timer { 11 class RestartableTimer implements Timer {
14 /// The duration of the timer. 12 /// The duration of the timer.
15 final Duration _duration; 13 final Duration _duration;
16 14
(...skipping 22 matching lines...) Expand all
39 /// This restarts the timer even if it has already fired or has been canceled. 37 /// This restarts the timer even if it has already fired or has been canceled.
40 void reset() { 38 void reset() {
41 _timer.cancel(); 39 _timer.cancel();
42 _timer = new Timer(_duration, _callback); 40 _timer = new Timer(_duration, _callback);
43 } 41 }
44 42
45 void cancel() { 43 void cancel() {
46 _timer.cancel(); 44 _timer.cancel();
47 } 45 }
48 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698