| 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 | 6 |
| 7 final _EventTargetImpl _ptr; | 7 final _EventTargetImpl _ptr; |
| 8 | 8 |
| 9 final Map<String, EventListenerList> _listenerMap; | 9 final Map<String, EventListenerList> _listenerMap; |
| 10 | 10 |
| 11 _EventsImpl(this._ptr) : _listenerMap = <EventListenerList>{}; | 11 _EventsImpl(this._ptr) : _listenerMap = <EventListenerList>{}; |
| 12 | 12 |
| 13 EventListenerList operator [](String type) { | 13 EventListenerList operator [](String type) { |
| 14 return _get(type.toLowerCase()); | |
| 15 } | |
| 16 | |
| 17 EventListenerList _get(String type) { | |
| 18 return _listenerMap.putIfAbsent(type, | 14 return _listenerMap.putIfAbsent(type, |
| 19 () => new _EventListenerListImpl(_ptr, type)); | 15 () => new _EventListenerListImpl(_ptr, type)); |
| 20 } | 16 } |
| 21 } | 17 } |
| 22 | 18 |
| 23 class _EventListenerWrapper { | 19 class _EventListenerWrapper { |
| 24 final EventListener raw; | 20 final EventListener raw; |
| 25 final Function wrapped; | 21 final Function wrapped; |
| 26 final bool useCapture; | 22 final bool useCapture; |
| 27 _EventListenerWrapper(this.raw, this.wrapped, this.useCapture); | 23 _EventListenerWrapper(this.raw, this.wrapped, this.useCapture); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 102 |
| 107 Events _on; | 103 Events _on; |
| 108 | 104 |
| 109 Events get on() { | 105 Events get on() { |
| 110 if (_on == null) _on = new _EventsImpl(this); | 106 if (_on == null) _on = new _EventsImpl(this); |
| 111 return _on; | 107 return _on; |
| 112 } | 108 } |
| 113 | 109 |
| 114 $!MEMBERS | 110 $!MEMBERS |
| 115 } | 111 } |
| OLD | NEW |