| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 71    */ | 71    */ | 
| 72   factory Timer.periodic(Duration duration, | 72   factory Timer.periodic(Duration duration, | 
| 73                          void callback(Timer timer)) { | 73                          void callback(Timer timer)) { | 
| 74     if (Zone.current == Zone.ROOT) { | 74     if (Zone.current == Zone.ROOT) { | 
| 75       // No need to bind the callback. We know that the root's timer will | 75       // No need to bind the callback. We know that the root's timer will | 
| 76       // be invoked in the root zone. | 76       // be invoked in the root zone. | 
| 77       return Zone.current.createPeriodicTimer(duration, callback); | 77       return Zone.current.createPeriodicTimer(duration, callback); | 
| 78     } | 78     } | 
| 79     // TODO(floitsch): the return type should be 'void', and the type | 79     // TODO(floitsch): the return type should be 'void', and the type | 
| 80     // should be inferred. | 80     // should be inferred. | 
| 81     var boundCallback = Zone.current.bindUnaryCallback/*<dynamic, Timer>*/( | 81     var boundCallback = Zone.current.bindUnaryCallback<dynamic, Timer>( | 
| 82         callback, runGuarded: true); | 82         callback, runGuarded: true); | 
| 83     return Zone.current.createPeriodicTimer(duration, boundCallback); | 83     return Zone.current.createPeriodicTimer(duration, boundCallback); | 
| 84   } | 84   } | 
| 85 | 85 | 
| 86   /** | 86   /** | 
| 87    * Runs the given [callback] asynchronously as soon as possible. | 87    * Runs the given [callback] asynchronously as soon as possible. | 
| 88    * | 88    * | 
| 89    * This function is equivalent to `new Timer(Duration.ZERO, callback)`. | 89    * This function is equivalent to `new Timer(Duration.ZERO, callback)`. | 
| 90    */ | 90    */ | 
| 91   static void run(void callback()) { | 91   static void run(void callback()) { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 105    * | 105    * | 
| 106    * A periodic timer is active if it has not been canceled. | 106    * A periodic timer is active if it has not been canceled. | 
| 107    */ | 107    */ | 
| 108   bool get isActive; | 108   bool get isActive; | 
| 109 | 109 | 
| 110   external static Timer _createTimer(Duration duration, void callback()); | 110   external static Timer _createTimer(Duration duration, void callback()); | 
| 111   external static Timer _createPeriodicTimer(Duration duration, | 111   external static Timer _createPeriodicTimer(Duration duration, | 
| 112                                              void callback(Timer timer)); | 112                                              void callback(Timer timer)); | 
| 113 } | 113 } | 
| 114 | 114 | 
| OLD | NEW | 
|---|