API Reference 0.7.1rikulo_eventDomEvent

DomEvent class

A view event that proxies a DOM event sent by the browser (such as Event, UIEvent, MouseEvent and KeyboardEvent in dart:html). The original DOM event can be found in cause.

class DomEvent extends ViewEvent {
 factory DomEvent(Event cause, [String type, View target])
 => cause is MouseEvent ? new _MSEvent(cause, type, target):
   cause is KeyboardEvent ? new _KBEvent(cause, type, target):
   cause is UIEvent ? new _UIEvent(cause, type, target):
     new DomEvent._(cause, type, target);

 DomEvent._(Event cause, String type, View target):
 super._(type != null ? type: cause.type, target),
 this.cause = cause;

 /** The DOM event sent by the browser that causes this event to be fired.
  */
 final Event cause;

 /** The Unicode value of a character key pressed.
  */
 int get charCode => 0;
 /** The Unicode value of a non-character key pressed.
  */
 int get keyCode => 0;
 /** It normalizes [keyCode] and [charCode] if it is a keyboard event.
  * It is recommended to watch [which] for keyboard key input.
  * For more detail, read about [MDC](https://developer.mozilla.org/en-US/docs/DOM/event.which).
  *
  * It also normalizes button presses (mouseDown and mouseUp events),
  * reporting 1 for left button, 2 for middle, and 3 for right.
  */
 int get which => 0;
 /** Indicates whether Alt+Graph key was pressed when the event fire.d
  */
 bool get altGraphKey => false;
 /** Indicates whether the ALT key was pressed when the event fired.
  */
 bool get altKey => false;
 /** Indicates whether the CTRL key was pressed when the event fired.
  */
 bool get ctrlKey => false;
 /** Indicates whether the META key was pressed when the event fired.
  */
 bool get metaKey => false;
 /** Indicates whether the SHIFT key was pressed when the event fired.
  */
 bool get shiftKey => false;

 /** The offset of the mouse pointer relative to the whole document.
  */
 Point get page => new Point(0, 0);
 /** The offset of the mouse pointer in the target node coordinate.
  * It is available only if [cause] is `MouseEvent`.
  *
  * This value may vary between platforms if the target node moves
  * after the event has fired or if the element has CSS transforms affecting it.
  */
 Point get offset => new Point(0, 0);
 /** The object in the clipboard.
  */
 DataTransfer get clipboardData => cause.clipboardData;
 /** The object used to transfer data, or null if not available.
  */
 DataTransfer get dataTransfer => null;
 /** Returns the time stamp.
  */
 int get timeStamp => cause.timeStamp;

 @override
 void stopPropagation() {
   super.stopPropagation();
   cause.stopPropagation();
 }
 @override
 void preventDefault() {
   cause.preventDefault();
 }
 @override
 String toString() => "DomEvent($target,$cause)";
}

Extends

ViewEvent > DomEvent

Constructors

factory DomEvent(Event cause, [String type, View target]) #

Constructor.

  • type is the event type, such as click.
  • target is the view that this event is targeting. If not specified, it will be assigned automatically when the sendEvent method is called.

docs inherited from ViewEvent
factory DomEvent(Event cause, [String type, View target])
=> cause is MouseEvent ? new _MSEvent(cause, type, target):
 cause is KeyboardEvent ? new _KBEvent(cause, type, target):
 cause is UIEvent ? new _UIEvent(cause, type, target):
   new DomEvent._(cause, type, target);

Properties

final bool altGraphKey #

Indicates whether Alt+Graph key was pressed when the event fire.d

bool get altGraphKey => false;

final bool altKey #

Indicates whether the ALT key was pressed when the event fired.

bool get altKey => false;

final Event cause #

The DOM event sent by the browser that causes this event to be fired.

final Event cause

final int charCode #

The Unicode value of a character key pressed.

int get charCode => 0;

final DataTransfer clipboardData #

The object in the clipboard.

DataTransfer get clipboardData => cause.clipboardData;

final bool ctrlKey #

Indicates whether the CTRL key was pressed when the event fired.

bool get ctrlKey => false;

View currentTarget #

inherited from ViewEvent

The view that is handling this event currently.

View currentTarget

final DataTransfer dataTransfer #

The object used to transfer data, or null if not available.

DataTransfer get dataTransfer => null;

final bool isPropagationStopped #

inherited from ViewEvent

Returns whether this event's propagation is stopped.

Default: false.

It becomes true if stopPropagation is called, and then all remaining event listeners are ignored.

bool get isPropagationStopped => _propStop;

final int keyCode #

The Unicode value of a non-character key pressed.

int get keyCode => 0;

final bool metaKey #

Indicates whether the META key was pressed when the event fired.

bool get metaKey => false;

final Point offset #

The offset of the mouse pointer in the target node coordinate. It is available only if cause is MouseEvent.

This value may vary between platforms if the target node moves after the event has fired or if the element has CSS transforms affecting it.

Point get offset => new Point(0, 0);

final Point page #

The offset of the mouse pointer relative to the whole document.

Point get page => new Point(0, 0);

final bool shiftKey #

Indicates whether the SHIFT key was pressed when the event fired.

bool get shiftKey => false;

View target #

inherited from ViewEvent

Returns the view that this event is targeting to.

View target

final int timeStamp #

Returns the time stamp.

int get timeStamp => cause.timeStamp;

final String type #

inherited from ViewEvent

Returns the event's type.

String get type => _type;

final int which #

It normalizes keyCode and charCode if it is a keyboard event. It is recommended to watch which for keyboard key input. For more detail, read about MDC.

It also normalizes button presses (mouseDown and mouseUp events), reporting 1 for left button, 2 for middle, and 3 for right.

int get which => 0;

Methods

void preventDefault() #

Prevents the browser's default behavior.

docs inherited from ViewEvent
@override
void preventDefault() {
 cause.preventDefault();
}

void stopPropagation() #

Stops the propagation. Once called, all remaining event listeners, if any, are ignored.

docs inherited from ViewEvent
@override
void stopPropagation() {
 super.stopPropagation();
 cause.stopPropagation();
}

String toString() #

Returns a string representation of this object.

docs inherited from Object
@override
String toString() => "DomEvent($target,$cause)";