| 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 /** | 7 /** |
| 8 * Base class that supports listening for and dispatching browser events. | 8 * Base class that supports listening for and dispatching browser events. |
| 9 * | 9 * |
| 10 * Events can either be accessed by string name (using the indexed getter) or by | 10 * Events can either be accessed by string name (using the indexed getter) or by |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return this; | 46 return this; |
| 47 } | 47 } |
| 48 | 48 |
| 49 EventListenerList remove(EventListener listener, | 49 EventListenerList remove(EventListener listener, |
| 50 [bool useCapture = false]) { | 50 [bool useCapture = false]) { |
| 51 _remove(listener, useCapture); | 51 _remove(listener, useCapture); |
| 52 return this; | 52 return this; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool dispatch(Event evt) { | 55 bool dispatch(Event evt) { |
| 56 return _ptr.$dom_dispatchEvent(evt); | 56 return _ptr.dispatchEvent(evt); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void _add(EventListener listener, bool useCapture) { | 59 void _add(EventListener listener, bool useCapture) { |
| 60 _ptr.$dom_addEventListener(_type, listener, useCapture); | 60 _ptr.$dom_addEventListener(_type, listener, useCapture); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void _remove(EventListener listener, bool useCapture) { | 63 void _remove(EventListener listener, bool useCapture) { |
| 64 _ptr.$dom_removeEventListener(_type, listener, useCapture); | 64 _ptr.$dom_removeEventListener(_type, listener, useCapture); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Base class for all browser objects that support events. | 69 * Base class for all browser objects that support events. |
| 70 * | 70 * |
| 71 * Use the [on] property to add, remove, and dispatch events (rather than | 71 * Use the [on] property to add, remove, and dispatch events (rather than |
| 72 * [$dom_addEventListener], [$dom_dispatchEvent], and | 72 * [$dom_addEventListener], [$dom_dispatchEvent], and |
| 73 * [$dom_removeEventListener]) for compile-time type checks and a more concise | 73 * [$dom_removeEventListener]) for compile-time type checks and a more concise |
| 74 * API. | 74 * API. |
| 75 */ | 75 */ |
| 76 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 76 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 77 | 77 |
| 78 @DomName('EventTarget.addEventListener, EventTarget.removeEventListener, Event
Target.dispatchEvent') | 78 @DomName('EventTarget.addEventListener, EventTarget.removeEventListener, Event
Target.dispatchEvent') |
| 79 Events get on => new Events(this); | 79 Events get on => new Events(this); |
| 80 $!MEMBERS | 80 $!MEMBERS |
| 81 } | 81 } |
| OLD | NEW |