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 class _EventsImpl implements Events { | 5 class _EventsImpl implements Events { |
6 /* Raw event target. */ | 6 /* Raw event target. */ |
7 // TODO(jacobr): it would be nice if we could specify this as | 7 // TODO(jacobr): it would be nice if we could specify this as |
8 // _EventTargetJs or EventTarget | 8 // _EventTargetImpl or EventTarget |
9 final var _ptr; | 9 final var _ptr; |
10 | 10 |
11 _EventsImpl(this._ptr); | 11 _EventsImpl(this._ptr); |
12 | 12 |
13 _EventListenerListImpl operator [](String type) => _get(type.toLowerCase()); | 13 _EventListenerListImpl operator [](String type) => _get(type.toLowerCase()); |
14 | 14 |
15 _EventListenerListImpl _get(String type) { | 15 _EventListenerListImpl _get(String type) { |
16 return new _EventListenerListImpl(_ptr, type); | 16 return new _EventListenerListImpl(_ptr, type); |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 class _EventListenerListImpl implements EventListenerList { | 20 class _EventListenerListImpl implements EventListenerList { |
21 | 21 |
22 // TODO(jacobr): make this _EventTargetJs | 22 // TODO(jacobr): make this _EventTargetImpl |
23 final var _ptr; | 23 final var _ptr; |
24 final String _type; | 24 final String _type; |
25 | 25 |
26 _EventListenerListImpl(this._ptr, this._type); | 26 _EventListenerListImpl(this._ptr, this._type); |
27 | 27 |
28 // TODO(jacobr): implement equals. | 28 // TODO(jacobr): implement equals. |
29 | 29 |
30 _EventListenerListImpl add(EventListener listener, | 30 _EventListenerListImpl add(EventListener listener, |
31 [bool useCapture = false]) { | 31 [bool useCapture = false]) { |
32 _add(listener, useCapture); | 32 _add(listener, useCapture); |
(...skipping 21 matching lines...) Expand all Loading... |
54 _ptr._removeEventListener(_type, listener, useCapture); | 54 _ptr._removeEventListener(_type, listener, useCapture); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 59 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
60 | 60 |
61 Events get on() => new _EventsImpl(this); | 61 Events get on() => new _EventsImpl(this); |
62 $!MEMBERS | 62 $!MEMBERS |
63 } | 63 } |
OLD | NEW |