Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: client/html/src/EventTargetWrappingImplementation.dart

Issue 9148015: Example showing alternate async measurement solution (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final version Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698