| 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 html; | 5 part of html; |
| 6 | 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" { | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" { |
| 8 | 8 |
| 9 Document get document => JS('Document', '#.document', this); | 9 Document get document => JS('Document', '#.document', this); |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // On Firefox the code that implements 'is Location' fails to find the patch | 64 // On Firefox the code that implements 'is Location' fails to find the patch |
| 65 // stub on Object.prototype and throws an exception. | 65 // stub on Object.prototype and throws an exception. |
| 66 try { | 66 try { |
| 67 return thing is Location; | 67 return thing is Location; |
| 68 } catch (e) { | 68 } catch (e) { |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Executes a [callback] after the next batch of browser layout measurements | 74 * Executes a [callback] after the immediate execution stack has completed. |
| 75 * has completed or would have completed if any browser layout measurements | 75 * |
| 76 * had been scheduled. | 76 * This will cause the callback to be executed after all processing has |
| 77 * completed for the current event, but before any subsequent events. |
| 77 */ | 78 */ |
| 78 void requestLayoutFrame(TimeoutHandler callback) { | 79 void setImmediate(TimeoutHandler callback) { |
| 79 _addMeasurementFrameCallback(callback); | 80 _addMicrotaskCallback(callback); |
| 80 } | 81 } |
| 81 | 82 |
| 82 @DomName('DOMWindow.requestAnimationFrame') | 83 @DomName('DOMWindow.requestAnimationFrame') |
| 83 int requestAnimationFrame(RequestAnimationFrameCallback callback) { | 84 int requestAnimationFrame(RequestAnimationFrameCallback callback) { |
| 84 _ensureRequestAnimationFrame(); | 85 _ensureRequestAnimationFrame(); |
| 85 return _requestAnimationFrame(callback); | 86 return _requestAnimationFrame(callback); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void cancelAnimationFrame(id) { | 89 void cancelAnimationFrame(id) { |
| 89 _ensureRequestAnimationFrame(); | 90 _ensureRequestAnimationFrame(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 * running in this window. | 153 * running in this window. |
| 153 */ | 154 */ |
| 154 void registerPort(String name, var port) { | 155 void registerPort(String name, var port) { |
| 155 var serialized = _serialize(port); | 156 var serialized = _serialize(port); |
| 156 document.documentElement.attributes['dart-port:$name'] = json.stringify(seri
alized); | 157 document.documentElement.attributes['dart-port:$name'] = json.stringify(seri
alized); |
| 157 } | 158 } |
| 158 | 159 |
| 159 @DomName('Window.console') | 160 @DomName('Window.console') |
| 160 Console get console => Console.safeConsole; | 161 Console get console => Console.safeConsole; |
| 161 | 162 |
| 163 /// Checks if _setImmediate is supported. |
| 164 static bool get _supportsSetImmediate => |
| 165 JS('bool', '!!(window.setImmediate)'); |
| 166 |
| 167 // Set immediate implementation for IE |
| 168 void _setImmediate(void callback()) { |
| 169 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0)); |
| 170 } |
| 171 |
| 162 $!MEMBERS | 172 $!MEMBERS |
| 163 } | 173 } |
| OLD | NEW |