Base class that supports listening for and dispatching browser events.

Normally events are accessed via the Stream getter:

element.onMouseOver.listen((e) => print('Mouse over!'));

To access bubbling events which are declared on one element, but may bubble up to another element type (common for MediaElement events):

MediaElement.pauseEvent.forTarget(document.body).listen(...);

To useCapture on events:

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

Custom events can be declared as:

class DataGenerator {
  static EventStreamProvider<Event> dataEvent =
      new EventStreamProvider('data');
}

Then listeners should access the event with:

DataGenerator.dataEvent.forTarget(element).listen(...);

Custom events can also be accessed as:

element.on['some_event'].listen(...);

This approach is generally discouraged as it loses the event typing and some DOM events may have multiple platform-dependent event names under the covers. By using the standard Stream getters you will get the platform specific event name automatically.

Implemented by

Constructors

Events(EventTarget _ptr)

Properties

hashCode int

获取对象的哈希值。

read-only, inherited
runtimeType Type

表示对象的运行时类型。

read-only, inherited

Operators

operator ==(other) bool

相等操作符。

inherited
operator [](String type) Stream

Methods

noSuchMethod(Invocation invocation) → dynamic

当一个不存在的函数或成员变量被访问时,该函数被调用。

inherited
toString() String

返回一个用来表示对象的字符串。

inherited