| 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 too much, | |
| 105 * so more than one tick should have happened, | |
| 106 * all but the last tick in the past are considered "missed", | |
| 107 * and no callback is invoked for them. | |
| 108 * The [tick] count reflects the number of durations that have passed and | |
| 109 * not the number of callback invocations that have happened. | |
| 110 */ | |
| 111 int get tick; | |
| 112 | |
| 113 /** | |
| 114 * Returns whether the timer is still active. | 99 * Returns whether the timer is still active. |
| 115 * | 100 * |
| 116 * A non-periodic timer is active if the callback has not been executed, | 101 * A non-periodic timer is active if the callback has not been executed, |
| 117 * and the timer has not been canceled. | 102 * and the timer has not been canceled. |
| 118 * | 103 * |
| 119 * A periodic timer is active if it has not been canceled. | 104 * A periodic timer is active if it has not been canceled. |
| 120 */ | 105 */ |
| 121 bool get isActive; | 106 bool get isActive; |
| 122 | 107 |
| 123 external static Timer _createTimer(Duration duration, void callback()); | 108 external static Timer _createTimer(Duration duration, void callback()); |
| 124 external static Timer _createPeriodicTimer( | 109 external static Timer _createPeriodicTimer( |
| 125 Duration duration, void callback(Timer timer)); | 110 Duration duration, void callback(Timer timer)); |
| 126 } | 111 } |
| OLD | NEW |