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)@Native("Window,DOMWindow") | 9 $(ANNOTATIONS)@Native("Window,DOMWindow") |
10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { | 10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 * Location currentLocation = window.location; | 78 * Location currentLocation = window.location; |
79 * print(currentLocation.href); // 'http://www.example.com:80/' | 79 * print(currentLocation.href); // 'http://www.example.com:80/' |
80 */ | 80 */ |
81 Location get location => _location; | 81 Location get location => _location; |
82 | 82 |
83 // TODO: consider forcing users to do: window.location.assign('string'). | 83 // TODO: consider forcing users to do: window.location.assign('string'). |
84 /** | 84 /** |
85 * Sets the window's location, which causes the browser to navigate to the new | 85 * Sets the window's location, which causes the browser to navigate to the new |
86 * location. [value] may be a Location object or a String. | 86 * location. [value] may be a Location object or a String. |
87 */ | 87 */ |
88 void set location(value) { | 88 set location(value) { |
89 _location = value; | 89 _location = value; |
90 } | 90 } |
91 | 91 |
92 // Native getter and setter to access raw Location object. | 92 // Native getter and setter to access raw Location object. |
93 dynamic get _location => JS('Location|Null', '#.location', this); | 93 dynamic get _location => JS('Location|Null', '#.location', this); |
94 void set _location(value) { | 94 set _location(value) { |
95 JS('void', '#.location = #', this, value); | 95 JS('void', '#.location = #', this, value); |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * Called to draw an animation frame and then request the window to repaint | 99 * Called to draw an animation frame and then request the window to repaint |
100 * after [callback] has finished (creating the animation). | 100 * after [callback] has finished (creating the animation). |
101 * | 101 * |
102 * Use this method only if you need to later call [cancelAnimationFrame]. If | 102 * Use this method only if you need to later call [cancelAnimationFrame]. If |
103 * not, the preferred Dart idiom is to set animation frames by calling | 103 * not, the preferred Dart idiom is to set animation frames by calling |
104 * [animationFrame], which returns a Future. | 104 * [animationFrame], which returns a Future. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 | 314 |
315 $if DART2JS | 315 $if DART2JS |
316 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { | 316 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { |
317 String _returnValue; | 317 String _returnValue; |
318 | 318 |
319 _BeforeUnloadEvent(Event base): super(base); | 319 _BeforeUnloadEvent(Event base): super(base); |
320 | 320 |
321 String get returnValue => _returnValue; | 321 String get returnValue => _returnValue; |
322 | 322 |
323 void set returnValue(String value) { | 323 set returnValue(String value) { |
324 _returnValue = value; | 324 _returnValue = value; |
325 // FF and IE use the value as the return value, Chrome will return this from | 325 // FF and IE use the value as the return value, Chrome will return this from |
326 // the event callback function. | 326 // the event callback function. |
327 if (JS('bool', '("returnValue" in #)', wrapped)) { | 327 if (JS('bool', '("returnValue" in #)', wrapped)) { |
328 JS('void', '#.returnValue = #', wrapped, value); | 328 JS('void', '#.returnValue = #', wrapped, value); |
329 } | 329 } |
330 } | 330 } |
331 } | 331 } |
332 $endif | 332 $endif |
333 | 333 |
(...skipping 26 matching lines...) Expand all Loading... |
360 | 360 |
361 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false
}) { | 361 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false
}) { |
362 return new _ElementEventStreamImpl(e, _eventType, useCapture); | 362 return new _ElementEventStreamImpl(e, _eventType, useCapture); |
363 } | 363 } |
364 | 364 |
365 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, | 365 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, |
366 {bool useCapture: false}) { | 366 {bool useCapture: false}) { |
367 return new _ElementListEventStreamImpl(e, _eventType, useCapture); | 367 return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
368 } | 368 } |
369 } | 369 } |
OLD | NEW |