forElement method

ElementStream<T> forElement(
  1. Element e,
  2. {bool useCapture = false}

Gets a Stream for this event type, on the specified element.

This will always return a broadcast stream so multiple listeners can be used simultaneously.

This may be used to capture DOM events:

Element.keyDownEvent.forElement(element, useCapture: true).listen(...);

// Alternate method:

Or for listening to an event which will bubble through the DOM tree:


See also:


ElementStream<T> forElement(Element e, {bool useCapture = false}) {
  return new _ElementEventStreamImpl<T>(e, _eventType, useCapture);