| 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 $if DART2JS | 7 $if DART2JS |
| 8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { | 8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { |
| 9 $else | 9 $else |
| 10 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 10 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 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 * Deregister a [port] on this window under the given [name]. This |
| 52 * port may be retrieved by any isolate (or JavaScript script) |
| 53 * running in this window. |
| 54 */ |
| 55 void deregisterPort(String name) { |
| 56 document.documentElement.attributes.remove('dart-port:$name'); |
| 57 } |
| 58 |
| 59 /** |
| 51 * Returns a Future that completes just before the window is about to | 60 * Returns a Future that completes just before the window is about to |
| 52 * repaint so the user can draw an animation frame. | 61 * repaint so the user can draw an animation frame. |
| 53 * | 62 * |
| 54 * If you need to later cancel this animation, use [requestAnimationFrame] | 63 * If you need to later cancel this animation, use [requestAnimationFrame] |
| 55 * instead. | 64 * instead. |
| 56 * | 65 * |
| 57 * The [Future] completes to a timestamp that represents a floating | 66 * The [Future] completes to a timestamp that represents a floating |
| 58 * point value of the number of milliseconds that have elapsed since the page | 67 * 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 | 68 * started to load (which is also the timestamp at this call to |
| 60 * animationFrame). | 69 * animationFrame). |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 285 |
| 277 @DomName('Window.onbeforeunload') | 286 @DomName('Window.onbeforeunload') |
| 278 @DocsEditable() | 287 @DocsEditable() |
| 279 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this); | 288 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this); |
| 280 | 289 |
| 281 void moveTo(Point p) { | 290 void moveTo(Point p) { |
| 282 $dom_moveTo(p.x, p.y); | 291 $dom_moveTo(p.x, p.y); |
| 283 } | 292 } |
| 284 | 293 |
| 285 $if DART2JS | 294 $if DART2JS |
| 286 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', | 295 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', |
| 287 '#.scrollX', this) : document.documentElement.scrollLeft; | 296 '#.scrollX', this) : document.documentElement.scrollLeft; |
| 288 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', | 297 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', |
| 289 '#.scrollY', this) : document.documentElement.scrollTop; | 298 '#.scrollY', this) : document.documentElement.scrollTop; |
| 290 $endif | 299 $endif |
| 291 } | 300 } |
| 292 | 301 |
| 293 /** | 302 /** |
| 294 * Event object that is fired before the window is closed. | 303 * Event object that is fired before the window is closed. |
| 295 * | 304 * |
| 296 * The standard window close behavior can be prevented by setting the | 305 * The standard window close behavior can be prevented by setting the |
| 297 * [returnValue]. This will display a dialog to the user confirming that they | 306 * [returnValue]. This will display a dialog to the user confirming that they |
| 298 * want to close the page. | 307 * want to close the page. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 return wrapped.returnValue; | 348 return wrapped.returnValue; |
| 340 }); | 349 }); |
| 341 | 350 |
| 342 return controller.stream; | 351 return controller.stream; |
| 343 } | 352 } |
| 344 | 353 |
| 345 String getEventType(EventTarget target) { | 354 String getEventType(EventTarget target) { |
| 346 return _eventType; | 355 return _eventType; |
| 347 } | 356 } |
| 348 } | 357 } |
| OLD | NEW |