Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:html
  3. Events class
Events
description

Events class

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 bubbleup 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 andsome DOM events may have multiple platform-dependent event names under thecovers. By using the standard Stream getters you will get the platformspecific event name automatically.

Implementers

Constructors

Events(EventTarget_ptr)

Properties

hashCodeint
The hash code for this object.
no setterinherited
runtimeTypeType
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocationinvocation)→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString()String
A string representation of this object.
inherited

Operators

operator ==(Objectother)bool
The equality operator.
inherited
operator [](Stringtype)Stream<Event>
  1. Dart
  2. dart:html
  3. Events class
dart:html library

[8]ページ先頭

©2009-2025 Movatter.jp