method addHostListeners


void addHostListeners()

Attach event listeners on the host (this) element.

Source

void addHostListeners() {
  var events = _element._eventDelegates;
  if (events.isEmpty) return;

  _eventsLog.fine(() => '[$_name] addHostListeners: $events');

  // NOTE: host events look like bindings but really are not;
  // (1) we don't want the attribute to be set and (2) we want to support
  // multiple event listeners ('host' and 'instance') and Node.bind
  // by default supports 1 thing being bound.
  events.forEach((type, methodName) {
    // Dart note: the getEventHandler method is on our PolymerExpressions.
    PolymerGesturesJs.addEventListener(
        this, type,
        Zone.current.bindUnaryCallback(
            element.syntax.getEventHandler(this, this, methodName)));
  });
}