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

Side by Side Diff: client/dom/templates/html/frog/impl_EventTarget.darttemplate

Issue 9403004: Wrapperless dart:html generator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final version to check in. changes generator script but doesn't check in an active version of the … Created 8 years, 10 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 // _EventTargetJs or EventTarget
9 final var _ptr;
10
11 _EventsImpl(this._ptr);
12
13 _EventListenerListImpl operator [](String type) => _get(type.toLowerCase());
14
15 _EventListenerListImpl _get(String type) {
16 return new _EventListenerListImpl(_ptr, type);
17 }
18 }
19
20 class _EventListenerListImpl implements EventListenerList {
21
22 // TODO(jacobr): make this _EventTargetJs
23 final var _ptr;
24 final String _type;
25
26 _EventListenerListImpl(this._ptr, this._type);
27
28 // TODO(jacobr): implement equals.
29
30 _EventListenerListImpl add(EventListener listener,
31 [bool useCapture = false]) {
32 _add(listener, useCapture);
33 return this;
34 }
35
36 _EventListenerListImpl remove(EventListener listener,
37 [bool useCapture = false]) {
38 _remove(listener, useCapture);
39 return this;
40 }
41
42 bool dispatch(Event evt) {
43 // TODO(jacobr): what is the correct behavior here. We could alternately
44 // force the event to have the expected type.
45 assert(evt.type == _type);
46 return _ptr._dispatchEvent(evt);
47 }
48
49 void _add(EventListener listener, bool useCapture) {
50 _ptr._addEventListener(_type, listener, useCapture);
51 }
52
53 void _remove(EventListener listener, bool useCapture) {
54 _ptr._removeEventListener(_type, listener, useCapture);
55 }
56 }
57
58
59 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
60
61 Events get on() => new _EventsImpl(this);
62 $!MEMBERS
63 }
OLDNEW
« no previous file with comments | « client/dom/templates/html/frog/impl_Event.darttemplate ('k') | client/dom/templates/html/frog/impl_HtmlElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698