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

Side by Side Diff: sdk/lib/html/templates/html/impl/impl_EventTarget.darttemplate

Issue 11365019: Merging dart:html interfaces and implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merging with latest. Created 8 years, 1 month 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) 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 Events {
6 /* Raw event target. */ 6 /* Raw event target. */
7 // TODO(jacobr): it would be nice if we could specify this as 7 final EventTarget _ptr;
8 // _EventTargetImpl or EventTarget
9 final _ptr;
10 8
11 _EventsImpl(this._ptr); 9 Events(this._ptr);
12 10
13 _EventListenerListImpl operator [](String type) { 11 EventListenerList operator [](String type) {
14 return new _EventListenerListImpl(_ptr, type); 12 return new EventListenerList(_ptr, type);
15 } 13 }
16 } 14 }
17 15
18 class _EventListenerListImpl implements EventListenerList { 16 class EventListenerList {
19 17
20 // TODO(jacobr): make this _EventTargetImpl 18 final EventTarget _ptr;
21 final _ptr;
22 final String _type; 19 final String _type;
23 20
24 _EventListenerListImpl(this._ptr, this._type); 21 EventListenerList(this._ptr, this._type);
25 22
26 // TODO(jacobr): implement equals. 23 // TODO(jacobr): implement equals.
27 24
28 _EventListenerListImpl add(EventListener listener, 25 EventListenerList add(EventListener listener,
29 [bool useCapture = false]) { 26 [bool useCapture = false]) {
30 _add(listener, useCapture); 27 _add(listener, useCapture);
31 return this; 28 return this;
32 } 29 }
33 30
34 _EventListenerListImpl remove(EventListener listener, 31 EventListenerList remove(EventListener listener,
35 [bool useCapture = false]) { 32 [bool useCapture = false]) {
36 _remove(listener, useCapture); 33 _remove(listener, useCapture);
37 return this; 34 return this;
38 } 35 }
39 36
40 bool dispatch(Event evt) { 37 bool dispatch(Event evt) {
41 return _ptr.$dom_dispatchEvent(evt); 38 return _ptr.$dom_dispatchEvent(evt);
42 } 39 }
43 40
44 void _add(EventListener listener, bool useCapture) { 41 void _add(EventListener listener, bool useCapture) {
45 _ptr.$dom_addEventListener(_type, listener, useCapture); 42 _ptr.$dom_addEventListener(_type, listener, useCapture);
46 } 43 }
47 44
48 void _remove(EventListener listener, bool useCapture) { 45 void _remove(EventListener listener, bool useCapture) {
49 _ptr.$dom_removeEventListener(_type, listener, useCapture); 46 _ptr.$dom_removeEventListener(_type, listener, useCapture);
50 } 47 }
51 } 48 }
52 49
53 50
54 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 51 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
55 52
56 Events get on => new _EventsImpl(this); 53 /** @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent */
54 Events get on => new Events(this);
57 $!MEMBERS 55 $!MEMBERS
58 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698