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_isolate; | |
6 | |
7 abstract class Timer { | 5 abstract class Timer { |
8 /** | 6 /** |
9 * Creates a new timer. The [callback] callback is invoked after | 7 * Creates a new timer. The [callback] callback is invoked after |
10 * [milliSeconds] milliseconds. | 8 * [milliSeconds] milliseconds. |
11 */ | 9 */ |
12 factory Timer(int milliSeconds, void callback(Timer timer)) { | 10 factory Timer(int milliSeconds, void callback(Timer timer)) { |
13 if (_TimerFactory._factory == null) { | 11 if (_TimerFactory._factory == null) { |
14 throw new UnsupportedError("Timer interface not supported."); | 12 throw new UnsupportedError("Timer interface not supported."); |
15 } | 13 } |
16 return _TimerFactory._factory(milliSeconds, callback, false); | 14 return _TimerFactory._factory(milliSeconds, callback, false); |
(...skipping 25 matching lines...) Expand all Loading... |
42 | 40 |
43 class _TimerFactory { | 41 class _TimerFactory { |
44 static _TimerFactoryClosure _factory; | 42 static _TimerFactoryClosure _factory; |
45 } | 43 } |
46 | 44 |
47 // TODO(ahe): Warning: this is NOT called by Dartium. Instead, it sets | 45 // TODO(ahe): Warning: this is NOT called by Dartium. Instead, it sets |
48 // [_TimerFactory._factory] directly. | 46 // [_TimerFactory._factory] directly. |
49 void _setTimerFactoryClosure(_TimerFactoryClosure closure) { | 47 void _setTimerFactoryClosure(_TimerFactoryClosure closure) { |
50 _TimerFactory._factory = closure; | 48 _TimerFactory._factory = closure; |
51 } | 49 } |
OLD | NEW |