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 // _EventTargetImpl or EventTarget | 8 // _EventTargetImpl or EventTarget |
9 final var _ptr; | 9 final var _ptr; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 _EventListenerListImpl remove(EventListener listener, | 36 _EventListenerListImpl remove(EventListener listener, |
37 [bool useCapture = false]) { | 37 [bool useCapture = false]) { |
38 _remove(listener, useCapture); | 38 _remove(listener, useCapture); |
39 return this; | 39 return this; |
40 } | 40 } |
41 | 41 |
42 bool dispatch(Event evt) { | 42 bool dispatch(Event evt) { |
43 // TODO(jacobr): what is the correct behavior here. We could alternately | 43 // TODO(jacobr): what is the correct behavior here. We could alternately |
44 // force the event to have the expected type. | 44 // force the event to have the expected type. |
45 assert(evt.type == _type); | 45 assert(evt.type == _type); |
46 return _ptr._dispatchEvent(evt); | 46 return _ptr.$dom_dispatchEvent(evt); |
47 } | 47 } |
48 | 48 |
49 void _add(EventListener listener, bool useCapture) { | 49 void _add(EventListener listener, bool useCapture) { |
50 _ptr._addEventListener(_type, listener, useCapture); | 50 _ptr.$dom_addEventListener(_type, listener, useCapture); |
51 } | 51 } |
52 | 52 |
53 void _remove(EventListener listener, bool useCapture) { | 53 void _remove(EventListener listener, bool useCapture) { |
54 _ptr._removeEventListener(_type, listener, useCapture); | 54 _ptr.$dom_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 |