| 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 $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 @DocsEditable | 7 @DocsEditable |
| 8 $if DART2JS | 8 $if DART2JS |
| 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { | 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { |
| 10 $else | 10 $else |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 * request. This value only needs to be saved if you intend to call | 157 * request. This value only needs to be saved if you intend to call |
| 158 * [cancelAnimationFrame] so you can specify the particular animation to | 158 * [cancelAnimationFrame] so you can specify the particular animation to |
| 159 * cancel. | 159 * cancel. |
| 160 * | 160 * |
| 161 * Note: The supplied [callback] needs to call [requestAnimationFrame] again | 161 * Note: The supplied [callback] needs to call [requestAnimationFrame] again |
| 162 * for the animation to continue. | 162 * for the animation to continue. |
| 163 */ | 163 */ |
| 164 @DomName('Window.requestAnimationFrame') | 164 @DomName('Window.requestAnimationFrame') |
| 165 int requestAnimationFrame(RequestAnimationFrameCallback callback) { | 165 int requestAnimationFrame(RequestAnimationFrameCallback callback) { |
| 166 _ensureRequestAnimationFrame(); | 166 _ensureRequestAnimationFrame(); |
| 167 return _requestAnimationFrame(_wrapZone(callback)); | 167 return _requestAnimationFrame(callback); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void cancelAnimationFrame(int id) { | 170 void cancelAnimationFrame(int id) { |
| 171 _ensureRequestAnimationFrame(); | 171 _ensureRequestAnimationFrame(); |
| 172 _cancelAnimationFrame(id); | 172 _cancelAnimationFrame(id); |
| 173 } | 173 } |
| 174 | 174 |
| 175 @JSName('requestAnimationFrame') | 175 @JSName('requestAnimationFrame') |
| 176 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; | 176 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; |
| 177 | 177 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0)); | 231 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0)); |
| 232 } | 232 } |
| 233 $else | 233 $else |
| 234 /// Checks if _setImmediate is supported. | 234 /// Checks if _setImmediate is supported. |
| 235 static bool get _supportsSetImmediate => false; | 235 static bool get _supportsSetImmediate => false; |
| 236 | 236 |
| 237 /// Dartium stub for IE's setImmediate. | 237 /// Dartium stub for IE's setImmediate. |
| 238 void _setImmediate(void callback()) { | 238 void _setImmediate(void callback()) { |
| 239 throw new UnsupportedError('setImmediate is not supported'); | 239 throw new UnsupportedError('setImmediate is not supported'); |
| 240 } | 240 } |
| 241 | |
| 242 /** | |
| 243 * Called to draw an animation frame and then request the window to repaint | |
| 244 * after [callback] has finished (creating the animation). | |
| 245 * | |
| 246 * Use this method only if you need to later call [cancelAnimationFrame]. If | |
| 247 * not, the preferred Dart idiom is to set animation frames by calling | |
| 248 * [animationFrame], which returns a Future. | |
| 249 * | |
| 250 * Returns a non-zero valued integer to represent the request id for this | |
| 251 * request. This value only needs to be saved if you intend to call | |
| 252 * [cancelAnimationFrame] so you can specify the particular animation to | |
| 253 * cancel. | |
| 254 * | |
| 255 * Note: The supplied [callback] needs to call [requestAnimationFrame] again | |
| 256 * for the animation to continue. | |
| 257 */ | |
| 258 @DomName('Window.requestAnimationFrame') | |
| 259 int requestAnimationFrame(RequestAnimationFrameCallback callback) { | |
| 260 return _requestAnimationFrame(_wrapZone(callback)); | |
| 261 } | |
| 262 $endif | 241 $endif |
| 263 | 242 |
| 264 /** | 243 /** |
| 265 * Access a sandboxed file system of the specified `size`. If `persistent` is | 244 * Access a sandboxed file system of the specified `size`. If `persistent` is |
| 266 * true, the application will request permission from the user to create | 245 * true, the application will request permission from the user to create |
| 267 * lasting storage. This storage cannot be freed without the user's | 246 * lasting storage. This storage cannot be freed without the user's |
| 268 * permission. Returns a [Future] whose value stores a reference to the | 247 * permission. Returns a [Future] whose value stores a reference to the |
| 269 * sandboxed file system for use. Because the file system is sandboxed, | 248 * sandboxed file system for use. Because the file system is sandboxed, |
| 270 * applications cannot access file systems created in other web pages. | 249 * applications cannot access file systems created in other web pages. |
| 271 */ | 250 */ |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 return wrapped.returnValue; | 349 return wrapped.returnValue; |
| 371 }); | 350 }); |
| 372 | 351 |
| 373 return controller.stream; | 352 return controller.stream; |
| 374 } | 353 } |
| 375 | 354 |
| 376 String getEventType(EventTarget target) { | 355 String getEventType(EventTarget target) { |
| 377 return _eventType; | 356 return _eventType; |
| 378 } | 357 } |
| 379 } | 358 } |
| OLD | NEW |