EventBinding constructor

EventBinding(
  1. Element element,
  2. String type,
  3. DomEventCallback fn
)

Implementation

EventBinding(web.Element element, this.type, this.fn) {
  _subscription = web.EventStreamProvider<web.Event>(type).forElement(element).listen((event) {
    // Do not move to a field initializer: we need fn here to refer to the
    // field and not the constructor parameter.
    fn(event);
  });
}