| 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 /** | 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 * Normally events are accessed via the Stream getter: | 10 * Normally events are accessed via the Stream getter: |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 93 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
| 94 | 94 |
| 95 // Custom element created callback. | 95 // Custom element created callback. |
| 96 EventTarget._created(); | 96 EventTarget._created(); |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * This is an ease-of-use accessor for event streams which should only be | 99 * This is an ease-of-use accessor for event streams which should only be |
| 100 * used when an explicit accessor is not available. | 100 * used when an explicit accessor is not available. |
| 101 */ | 101 */ |
| 102 Events get on => new Events(this); | 102 Events get on => new Events(this); |
| 103 |
| 104 void addEventListener(String type, EventListener listener, [bool useCapture])
{ |
| 105 // TODO(leafp): This check is avoid a bug in our dispatch code when |
| 106 // listener is null. The browser treats this call as a no-op in this |
| 107 // case, so it's fine to short-circuit it, but we should not have to. |
| 108 if (listener != null) { |
| 109 _addEventListener(type, listener, useCapture); |
| 110 } |
| 111 } |
| 112 |
| 113 void removeEventListener(String type, EventListener listener, [bool useCapture
]) { |
| 114 // TODO(leafp): This check is avoid a bug in our dispatch code when |
| 115 // listener is null. The browser treats this call as a no-op in this |
| 116 // case, so it's fine to short-circuit it, but we should not have to. |
| 117 if (listener != null) { |
| 118 _removeEventListener(type, listener, useCapture); |
| 119 } |
| 120 } |
| 121 |
| 103 $!MEMBERS | 122 $!MEMBERS |
| 104 } | 123 } |
| OLD | NEW |