src/ol/events.js
function removeListeners(target, type) {
  const listeners = getListeners(target, type);
  if (listeners) {
    for (let i = 0, ii = listeners.length; i < ii; ++i) {
      /** @type {import("./events/Target.js").default} */ (target).
        removeEventListener(type, listeners[i].boundListener);
      clear(listeners[i]);
    }
    listeners.length = 0;
    const listenerMap = getListenerMap(target);
    if (listenerMap) {
      delete listenerMap[type];
      if (Object.keys(listenerMap).length === 0) {
        removeListenerMap(target);
      }
    }
  }
}
function removeListeners(target, type) {
  const listeners = getListeners(target, type);
  if (listeners) {
    for (let i = 0, ii = listeners.length; i < ii; ++i) {
      /** @type {import("./events/Target.js").default} */ (target).
        removeEventListener(type, listeners[i].boundListener);
      clear(listeners[i]);
    }
    listeners.length = 0;
    const listenerMap = getListenerMap(target);
    if (listenerMap) {
      delete listenerMap[type];
      if (Object.keys(listenerMap).length === 0) {
        removeListenerMap(target);
      }
    }
  }
}
function removeListeners ( target , type ) { const listeners = getListeners ( target , type ) ; if ( listeners ) { for ( let i = 0 , ii = listeners . length ; i < ii ; ++ i ) { /** @type {import("./events/Target.js").default} */ ( target ) . removeEventListener ( type , listeners [ i ] . boundListener ) ; clear ( listeners [ i ] ) ; } listeners . length = 0 ; const listenerMap = getListenerMap ( target ) ; if ( listenerMap ) { delete listenerMap [ type ] ; if ( Object . keys ( listenerMap ) . length === 0 ) { removeListenerMap ( target ) ; } } } }
Clean up all listener objects of the given type.  All properties on the
listener objects will be removed, and if no listeners remain in the listener
map, it will be removed from the target.
@param {import("./events/Target.js").EventTargetLike} target Target.
@param {string} type Type.
Clean up all listener objects of the given type . All properties on the listener objects will be removed and if no listeners remain in the listener map it will be removed from the target .