| 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 // Patch file for the dart:async library. | 5 // Patch file for the dart:async library. |
| 6 | 6 |
| 7 patch class Timer { | 7 patch class Timer { |
| 8 patch factory Timer(int milliseconds, void callback(Timer timer)) { | 8 patch factory Timer(int milliseconds, void callback(Timer timer)) { |
| 9 if (!hasTimer()) { | |
| 10 throw new UnsupportedError("Timer interface not supported."); | |
| 11 } | |
| 12 return new TimerImpl(milliseconds, callback); | 9 return new TimerImpl(milliseconds, callback); |
| 13 } | 10 } |
| 14 | 11 |
| 15 /** | 12 /** |
| 16 * Creates a new repeating timer. The [callback] is invoked every | 13 * Creates a new repeating timer. The [callback] is invoked every |
| 17 * [milliseconds] millisecond until cancelled. | 14 * [milliseconds] millisecond until cancelled. |
| 18 */ | 15 */ |
| 19 patch factory Timer.repeating(int milliseconds, void callback(Timer timer)) { | 16 patch factory Timer.repeating(int milliseconds, void callback(Timer timer)) { |
| 20 if (!hasTimer()) { | |
| 21 throw new UnsupportedError("Timer interface not supported."); | |
| 22 } | |
| 23 return new TimerImpl.repeating(milliseconds, callback); | 17 return new TimerImpl.repeating(milliseconds, callback); |
| 24 } | 18 } |
| 25 } | 19 } |
| OLD | NEW |