| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 /** | 97 /** |
| 98 * Returns whether the timer is still active. | 98 * Returns whether the timer is still active. |
| 99 * | 99 * |
| 100 * A non-periodic timer is active if the callback has not been executed, | 100 * A non-periodic timer is active if the callback has not been executed, |
| 101 * and the timer has not been canceled. | 101 * and the timer has not been canceled. |
| 102 * | 102 * |
| 103 * A periodic timer is active if it has not been canceled. | 103 * A periodic timer is active if it has not been canceled. |
| 104 */ | 104 */ |
| 105 bool get isActive; | 105 bool get isActive; |
| 106 | 106 |
| 107 @patch | |
| 108 static Timer _createTimer(Duration duration, void callback()) { | 107 static Timer _createTimer(Duration duration, void callback()) { |
| 109 int milliseconds = duration.inMilliseconds; | 108 int milliseconds = duration.inMilliseconds; |
| 110 if (milliseconds < 0) milliseconds = 0; | 109 if (milliseconds < 0) milliseconds = 0; |
| 111 return new TimerImpl(milliseconds, callback); | 110 return new TimerImpl(milliseconds, callback); |
| 112 } | 111 } |
| 113 @patch | |
| 114 static Timer _createPeriodicTimer(Duration duration, | 112 static Timer _createPeriodicTimer(Duration duration, |
| 115 void callback(Timer timer)) { | 113 void callback(Timer timer)) { |
| 116 int milliseconds = duration.inMilliseconds; | 114 int milliseconds = duration.inMilliseconds; |
| 117 if (milliseconds < 0) milliseconds = 0; | 115 if (milliseconds < 0) milliseconds = 0; |
| 118 return new TimerImpl.periodic(milliseconds, callback); | 116 return new TimerImpl.periodic(milliseconds, callback); |
| 119 } | 117 } |
| 120 } | 118 } |
| 121 | 119 |
| OLD | NEW |