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

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

Issue 10913125: Remove lib/dom directory! (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class _EventsImpl implements Events {
6 /* Raw event target. */
7 // TODO(jacobr): it would be nice if we could specify this as
8 // _EventTargetImpl or EventTarget
9 final Dynamic _ptr;
10
11 _EventsImpl(this._ptr);
12
13 _EventListenerListImpl operator [](String type) {
14 return new _EventListenerListImpl(_ptr, type);
15 }
16 }
17
18 class _EventListenerListImpl implements EventListenerList {
19
20 // TODO(jacobr): make this _EventTargetImpl
21 final Dynamic _ptr;
22 final String _type;
23
24 _EventListenerListImpl(this._ptr, this._type);
25
26 // TODO(jacobr): implement equals.
27
28 _EventListenerListImpl add(EventListener listener,
29 [bool useCapture = false]) {
30 _add(listener, useCapture);
31 return this;
32 }
33
34 _EventListenerListImpl remove(EventListener listener,
35 [bool useCapture = false]) {
36 _remove(listener, useCapture);
37 return this;
38 }
39
40 bool dispatch(Event evt) {
41 // TODO(jacobr): what is the correct behavior here. We could alternately
42 // force the event to have the expected type.
43 assert(evt.type == _type);
44 return _ptr.$dom_dispatchEvent(evt);
45 }
46
47 void _add(EventListener listener, bool useCapture) {
48 _ptr.$dom_addEventListener(_type, listener, useCapture);
49 }
50
51 void _remove(EventListener listener, bool useCapture) {
52 _ptr.$dom_removeEventListener(_type, listener, useCapture);
53 }
54 }
55
56
57 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
58
59 Events get on() => new _EventsImpl(this);
60 $!MEMBERS
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698