| 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 library swipe; | 5 library swipe; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:math'; | 9 import 'dart:math'; |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * Start an indefinite spin in the given direction. | 109 * Start an indefinite spin in the given direction. |
| 110 */ | 110 */ |
| 111 void startSpin(Element figure, int direction) { | 111 void startSpin(Element figure, int direction) { |
| 112 // If we're not already spinning - | 112 // If we're not already spinning - |
| 113 if (timer == null) { | 113 if (timer == null) { |
| 114 spinFigure(figure, direction); | 114 spinFigure(figure, direction); |
| 115 | 115 |
| 116 timer = new Timer.repeating(const Duration(milliseconds: 100), | 116 timer = new Timer.periodic(const Duration(milliseconds: 100), |
| 117 (Timer t) => spinFigure(figure, direction)); | 117 (Timer t) => spinFigure(figure, direction)); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * Stop any spin that may be in progress. | 122 * Stop any spin that may be in progress. |
| 123 */ | 123 */ |
| 124 void stopSpin() { | 124 void stopSpin() { |
| 125 if (timer != null) { | 125 if (timer != null) { |
| 126 timer.cancel(); | 126 timer.cancel(); |
| 127 timer = null; | 127 timer = null; |
| 128 } | 128 } |
| 129 } | 129 } |
| OLD | NEW |