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

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

Issue 1321613005: Dartium w/ JsInterop enabled (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * Base class that supports listening for and dispatching browser events. 8 * Base class that supports listening for and dispatching browser events.
9 * 9 *
10 * Normally events are accessed via the Stream getter: 10 * Normally events are accessed via the Stream getter:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 /** 87 /**
88 * Base class for all browser objects that support events. 88 * Base class for all browser objects that support events.
89 * 89 *
90 * Use the [on] property to add, and remove events 90 * Use the [on] property to add, and remove events
91 * for compile-time type checks and a more concise API. 91 * for compile-time type checks and a more concise API.
92 */ 92 */
93 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { 93 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
94 94
95 $if DARTIUM
96 // Default constructor to allow other classes e.g. GlobalEventHandlers to be
97 // constructed using _internalWrap when mapping Blink object to Dart class.
98 EventTarget();
99
100 $endif
95 // Custom element created callback. 101 // Custom element created callback.
96 EventTarget._created(); 102 EventTarget._created();
97 103
98 /** 104 /**
99 * This is an ease-of-use accessor for event streams which should only be 105 * This is an ease-of-use accessor for event streams which should only be
100 * used when an explicit accessor is not available. 106 * used when an explicit accessor is not available.
101 */ 107 */
102 Events get on => new Events(this); 108 Events get on => new Events(this);
103 109
104 void addEventListener(String type, EventListener listener, [bool useCapture]) { 110 void addEventListener(String type, EventListener listener, [bool useCapture]) {
105 // TODO(leafp): This check is avoid a bug in our dispatch code when 111 // TODO(leafp): This check is avoid a bug in our dispatch code when
106 // listener is null. The browser treats this call as a no-op in this 112 // listener is null. The browser treats this call as a no-op in this
107 // case, so it's fine to short-circuit it, but we should not have to. 113 // case, so it's fine to short-circuit it, but we should not have to.
108 if (listener != null) { 114 if (listener != null) {
109 _addEventListener(type, listener, useCapture); 115 _addEventListener(type, listener, useCapture);
110 } 116 }
111 } 117 }
112 118
113 void removeEventListener(String type, EventListener listener, [bool useCapture ]) { 119 void removeEventListener(String type, EventListener listener, [bool useCapture ]) {
114 // TODO(leafp): This check is avoid a bug in our dispatch code when 120 // TODO(leafp): This check is avoid a bug in our dispatch code when
115 // listener is null. The browser treats this call as a no-op in this 121 // listener is null. The browser treats this call as a no-op in this
116 // case, so it's fine to short-circuit it, but we should not have to. 122 // case, so it's fine to short-circuit it, but we should not have to.
117 if (listener != null) { 123 if (listener != null) {
118 _removeEventListener(type, listener, useCapture); 124 _removeEventListener(type, listener, useCapture);
119 } 125 }
120 } 126 }
121 127
122 $!MEMBERS 128 $!MEMBERS
123 } 129 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | tools/dom/templates/html/impl/impl_FileReader.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698