OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 /** | 7 /** |
8 * A count-down timer that can be configured to fire once or repeatedly. | 8 * A count-down timer that can be configured to fire once or repeatedly. |
9 * | 9 * |
10 * The timer counts down from the specified duration to 0. | 10 * The timer counts down from the specified duration to 0. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 static void run(void callback()) { | 89 static void run(void callback()) { |
90 new Timer(Duration.ZERO, callback); | 90 new Timer(Duration.ZERO, callback); |
91 } | 91 } |
92 | 92 |
93 /** | 93 /** |
94 * Cancels the timer. | 94 * Cancels the timer. |
95 */ | 95 */ |
96 void cancel(); | 96 void cancel(); |
97 | 97 |
98 /** | 98 /** |
99 * The number of durations preceeding the most recent timer event. | |
100 * | |
101 * The value starts at zero and is incremented each time a timer event | |
102 * occurs, so each callback will see a larger value than the previous one. | |
103 * | |
104 * If a periodic timer with a non-zero duration is delayed so much | |
105 * that more than one event is due at the time when the timer gets to run, | |
floitsch
2017/08/25 09:16:47
If a periodic timer with a non-zero duration is de
| |
106 * those events are combined into one callback | |
107 * and the tick counter is incremented by the number of combined events. | |
108 */ | |
109 int get tick; | |
110 | |
111 /** | |
99 * Returns whether the timer is still active. | 112 * Returns whether the timer is still active. |
100 * | 113 * |
101 * A non-periodic timer is active if the callback has not been executed, | 114 * A non-periodic timer is active if the callback has not been executed, |
102 * and the timer has not been canceled. | 115 * and the timer has not been canceled. |
103 * | 116 * |
104 * A periodic timer is active if it has not been canceled. | 117 * A periodic timer is active if it has not been canceled. |
105 */ | 118 */ |
106 bool get isActive; | 119 bool get isActive; |
107 | 120 |
108 external static Timer _createTimer(Duration duration, void callback()); | 121 external static Timer _createTimer(Duration duration, void callback()); |
109 external static Timer _createPeriodicTimer( | 122 external static Timer _createPeriodicTimer( |
110 Duration duration, void callback(Timer timer)); | 123 Duration duration, void callback(Timer timer)); |
111 } | 124 } |
OLD | NEW |