Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: tools/dom/templates/html/impl/impl_Window.darttemplate

Issue 16854004: Improve documentation for animationFrame. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 $if DART2JS 7 $if DART2JS
8 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Window,DOMWindow" { 8 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Window,DOMWindow" {
9 $else 9 $else
10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
(...skipping 30 matching lines...) Expand all
41 * port may be retrieved by any isolate (or JavaScript script) 41 * port may be retrieved by any isolate (or JavaScript script)
42 * running in this window. 42 * running in this window.
43 */ 43 */
44 void registerPort(String name, var port) { 44 void registerPort(String name, var port) {
45 var serialized = _serialize(port); 45 var serialized = _serialize(port);
46 document.documentElement.attributes['dart-port:$name'] = 46 document.documentElement.attributes['dart-port:$name'] =
47 json.stringify(serialized); 47 json.stringify(serialized);
48 } 48 }
49 49
50 /** 50 /**
51 * Returns a Future that completes just before the window is about to repaint 51 * Returns a Future that completes just before the window is about to
52 * so the user can draw an animation frame 52 * repaint so the user can draw an animation frame.
53 * 53 *
54 * If you need to later cancel this animation, use [requestAnimationFrame] 54 * If you need to later cancel this animation, use [requestAnimationFrame]
55 * instead. 55 * instead.
56 * 56 *
57 * The [Future] completes to a timestamp that represents a floating
58 * point value of the number of milliseconds that have elapsed since the page
59 * started to load (which is also the timestamp at this call to
60 * animationFrame).
61 *
57 * Note: The code that runs when the future completes should call 62 * Note: The code that runs when the future completes should call
58 * [animationFrame] again for the animation to continue. 63 * [animationFrame] again for the animation to continue.
59 */ 64 */
60 Future<num> get animationFrame { 65 Future<num> get animationFrame {
61 var completer = new Completer<num>(); 66 var completer = new Completer<num>();
62 requestAnimationFrame((time) { 67 requestAnimationFrame((time) {
63 completer.complete(time); 68 completer.complete(time);
64 }); 69 });
65 return completer.future; 70 return completer.future;
66 } 71 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return wrapped.returnValue; 328 return wrapped.returnValue;
324 }); 329 });
325 330
326 return controller.stream; 331 return controller.stream;
327 } 332 }
328 333
329 String getEventType(EventTarget target) { 334 String getEventType(EventTarget target) {
330 return _eventType; 335 return _eventType;
331 } 336 }
332 } 337 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698