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

Unified Diff: tools/dom/src/EventStreamProvider.dart

Issue 47543007: Update EventStream docs with new capture method on the string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/EventStreamProvider.dart
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 7f0b36496370581114352d3362c80297d1d1a690..bd5ead8c398f58daad0516ab79399de55b57c944 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -41,6 +41,20 @@ abstract class ElementStream<T extends Event> implements Stream<T> {
*/
Stream<T> matches(String selector);
+ /**
+ * Adds a capturing subscription to this stream.
+ *
+ * If the target of the event is a descendant of the element from which this
+ * stream derives then [onData] is called before the event propagates down to
+ * the target. This is the opposite of bubbling behavior, where the event
+ * is first processed for the event target and then bubbles upward.
+ *
+ * ## Other Resources
+ *
+ * * [Event Capture]
+ * (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-capture)
+ * from the W3C DOM Events specification.
+ */
StreamSubscription<T> capture(void onData(T event));
}
@@ -318,6 +332,9 @@ class EventStreamProvider<T extends Event> {
*
* Element.keyDownEvent.forTarget(element, useCapture: true).listen(...);
*
+ * // Alternate method:
+ * Element.keyDownEvent.forTarget(element).capture(...);
+ *
* Or for listening to an event which will bubble through the DOM tree:
*
* MediaElement.pauseEvent.forTarget(document.body).listen(...);
@@ -339,6 +356,13 @@ class EventStreamProvider<T extends Event> {
*
* Element.keyDownEvent.forElement(element, useCapture: true).listen(...);
*
+ * // Alternate method:
+ * Element.keyDownEvent.forElement(element).capture(...);
+ *
+ * Or for listening to an event which will bubble through the DOM tree:
+ *
+ * MediaElement.pauseEvent.forElement(document.body).listen(...);
+ *
* See also:
*
* [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698