addEvent method

  1. @override
void addEvent(
  1. String eventType
)
inherited

Implementation

@override
void addEvent(String eventType) {
  super.addEvent(eventType);

  if (eventHandlers.containsKey(eventType)) return; // Only listen once.

  // Only add listener once for all intersection related event
  bool isIntersectionObserverEvent = _isIntersectionObserverEvent(eventType);
  bool hasIntersectionObserverEvent = isIntersectionObserverEvent && _hasIntersectionObserverEvent(eventHandlers);

  addEventListener(eventType, _eventResponder);

  RenderBoxModel? selfRenderBoxModel = renderBoxModel;
  if (selfRenderBoxModel != null) {
    // Bind pointer responder.
    addEventResponder(selfRenderBoxModel);

    if (isIntersectionObserverEvent && !hasIntersectionObserverEvent) {
      selfRenderBoxModel.addIntersectionChangeListener(handleIntersectionChange);
    }
  }
}