on method

DocumentBody on(
  1. String eventName,
  2. dynamic fun(
    1. BodyElement,
    2. Event
    )
)

Allows to create a custom HTML event, for example, if you can't find the desired one.

Implementation

DocumentBody on(String eventName, Function(BodyElement, Event) fun) {
  // The element event can only be activated
  // after the element has been inserted.
  body.on[eventName].listen((Event event) {
    fun.call(body, event);
  });
  return this;
}