| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 $if DART2JS | 287 $if DART2JS |
| 288 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', | 288 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', |
| 289 '#.scrollX', this) : document.documentElement.scrollLeft; | 289 '#.scrollX', this) : document.documentElement.scrollLeft; |
| 290 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', | 290 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', |
| 291 '#.scrollY', this) : document.documentElement.scrollTop; | 291 '#.scrollY', this) : document.documentElement.scrollTop; |
| 292 $endif | 292 $endif |
| 293 } | 293 } |
| 294 | 294 |
| 295 /** | |
| 296 * Event object that is fired before the window is closed. | |
| 297 * | |
| 298 * The standard window close behavior can be prevented by setting the | |
| 299 * [returnValue]. This will display a dialog to the user confirming that they | |
| 300 * want to close the page. | |
| 301 */ | |
| 302 abstract class BeforeUnloadEvent implements Event { | |
| 303 /** | |
| 304 * If set to a non-null value, a dialog will be presented to the user | |
| 305 * confirming that they want to close the page. | |
| 306 */ | |
| 307 String returnValue; | |
| 308 } | |
| 309 | |
| 310 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { | 295 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { |
| 311 String _returnValue; | 296 String _returnValue; |
| 312 | 297 |
| 313 _BeforeUnloadEvent(Event base): super(base); | 298 _BeforeUnloadEvent(Event base): super(base); |
| 314 | 299 |
| 315 String get returnValue => _returnValue; | 300 String get returnValue => _returnValue; |
| 316 | 301 |
| 317 void set returnValue(String value) { | 302 void set returnValue(String value) { |
| 318 _returnValue = value; | 303 _returnValue = value; |
| 319 $if DART2JS | 304 $if DART2JS |
| (...skipping 21 matching lines...) Expand all Loading... |
| 341 return wrapped.returnValue; | 326 return wrapped.returnValue; |
| 342 }); | 327 }); |
| 343 | 328 |
| 344 return controller.stream; | 329 return controller.stream; |
| 345 } | 330 } |
| 346 | 331 |
| 347 String getEventType(EventTarget target) { | 332 String getEventType(EventTarget target) { |
| 348 return _eventType; | 333 return _eventType; |
| 349 } | 334 } |
| 350 } | 335 } |
| OLD | NEW |