| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 /* Raw event target. */ | 44 /* Raw event target. */ |
| 45 final EventTarget _ptr; | 45 final EventTarget _ptr; |
| 46 | 46 |
| 47 Events(this._ptr); | 47 Events(this._ptr); |
| 48 | 48 |
| 49 Stream operator [](String type) { | 49 Stream operator [](String type) { |
| 50 return new _EventStream(_ptr, type, false); | 50 return new _EventStream(_ptr, type, false); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 class ElementEvents extends Events { |
| 55 /* Raw event target. */ |
| 56 final Element _ptr; |
| 57 |
| 58 ElementEvents(Element ptr) : this._ptr = ptr, super(ptr); |
| 59 |
| 60 Stream operator [](String type) { |
| 61 return new _ElementEventStreamImpl(_ptr, type, false); |
| 62 } |
| 63 } |
| 64 |
| 54 /** | 65 /** |
| 55 * Base class for all browser objects that support events. | 66 * Base class for all browser objects that support events. |
| 56 * | 67 * |
| 57 * Use the [on] property to add, and remove events (rather than | 68 * Use the [on] property to add, and remove events (rather than |
| 58 * [$dom_addEventListener] and [$dom_removeEventListener] | 69 * [$dom_addEventListener] and [$dom_removeEventListener] |
| 59 * for compile-time type checks and a more concise API. | 70 * for compile-time type checks and a more concise API. |
| 60 */ | 71 */ |
| 61 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 72 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 62 | 73 |
| 63 // Custom element created callback. | 74 // Custom element created callback. |
| 64 EventTarget._created(); | 75 EventTarget._created(); |
| 65 | 76 |
| 66 /** | 77 /** |
| 67 * This is an ease-of-use accessor for event streams which should only be | 78 * This is an ease-of-use accessor for event streams which should only be |
| 68 * used when an explicit accessor is not available. | 79 * used when an explicit accessor is not available. |
| 69 */ | 80 */ |
| 70 Events get on => new Events(this); | 81 Events get on => new Events(this); |
| 71 $!MEMBERS | 82 $!MEMBERS |
| 72 } | 83 } |
| OLD | NEW |