| OLD | NEW |
| 1 // Copyright (c) 2011, 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 EventsImplementation implements Events { | 5 class EventsImplementation implements Events { |
| 6 /* Raw event target. */ | 6 /* Raw event target. */ |
| 7 var _ptr; | 7 var _ptr; |
| 8 | 8 |
| 9 Map<String, EventListenerList> _listenerMap; | 9 Map<String, EventListenerList> _listenerMap; |
| 10 | 10 |
| 11 EventsImplementation._wrap(this._ptr) { | 11 EventsImplementation._wrap(this._ptr) { |
| 12 // TODO(sigmund): the key type (String) yields a warning in frog and the vm, | 12 // TODO(sigmund): the key type (String) yields a warning in frog and the vm, |
| 13 // but it is currently necessary to compile with dartc. | 13 // but it is currently necessary to compile with dartc. |
| 14 _listenerMap = <String, EventListenerList>{}; | 14 _listenerMap = new Map<String, EventListenerList>(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 EventListenerList operator [](String type) { | 17 EventListenerList operator [](String type) { |
| 18 return _get(type.toLowerCase()); | 18 return _get(type.toLowerCase()); |
| 19 } | 19 } |
| 20 | 20 |
| 21 EventListenerList _get(String type) { | 21 EventListenerList _get(String type) { |
| 22 return _listenerMap.putIfAbsent(type, | 22 return _listenerMap.putIfAbsent(type, |
| 23 () => new EventListenerListImplementation(_ptr, type)); | 23 () => new EventListenerListImplementation(_ptr, type)); |
| 24 } | 24 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 EventTargetWrappingImplementation._wrap(ptr) : super._wrap(ptr); | 112 EventTargetWrappingImplementation._wrap(ptr) : super._wrap(ptr); |
| 113 | 113 |
| 114 Events get on() { | 114 Events get on() { |
| 115 if (_on === null) { | 115 if (_on === null) { |
| 116 _on = new EventsImplementation._wrap(_ptr); | 116 _on = new EventsImplementation._wrap(_ptr); |
| 117 } | 117 } |
| 118 return _on; | 118 return _on; |
| 119 } | 119 } |
| 120 } | 120 } |
| OLD | NEW |