dist/cropper.common.js
function addListener(element, type, listener) {
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  var _handler = listener;
  type.trim().split(REGEXP_SPACES).forEach(function (event) {
    if (options.once && !onceSupported) {
      var _element$listeners = element.listeners,
          listeners = _element$listeners === void 0 ? {} : _element$listeners;

      _handler = function handler() {
        delete listeners[event][listener];
        element.removeEventListener(event, _handler, options);

        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
          args[_key2] = arguments[_key2];
        }

        listener.apply(element, args);
      };

      if (!listeners[event]) {
        listeners[event] = {};
      }

      if (listeners[event][listener]) {
        element.removeEventListener(event, listeners[event][listener], options);
      }

      listeners[event][listener] = _handler;
      element.listeners = listeners;
    }

    element.addEventListener(event, _handler, options);
  });
}
function addListener(element, type, listener) {
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  var _handler = listener;
  type.trim().split(REGEXP_SPACES).forEach(function (event) {
    if (options.once && !onceSupported) {
      var _element$listeners = element.listeners,
          listeners = _element$listeners === void 0 ? {} : _element$listeners;

      _handler = function handler() {
        delete listeners[event][listener];
        element.removeEventListener(event, _handler, options);

        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
          args[_key2] = arguments[_key2];
        }

        listener.apply(element, args);
      };

      if (!listeners[event]) {
        listeners[event] = {};
      }

      if (listeners[event][listener]) {
        element.removeEventListener(event, listeners[event][listener], options);
      }

      listeners[event][listener] = _handler;
      element.listeners = listeners;
    }

    element.addEventListener(event, _handler, options);
  });
}
function addListener ( element , type , listener ) { var options = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : { } ; var _handler = listener ; type . trim ( ) . split ( REGEXP_SPACES ) . forEach ( function ( event ) { if ( options . once && ! onceSupported ) { var _element$listeners = element . listeners , listeners = _element$listeners === void 0 ? { } : _element$listeners ; _handler = function handler ( ) { delete listeners [ event ] [ listener ] ; element . removeEventListener ( event , _handler , options ) ; for ( var _len2 = arguments . length , args = new Array ( _len2 ) , _key2 = 0 ; _key2 < _len2 ; _key2 ++ ) { args [ _key2 ] = arguments [ _key2 ] ; } listener . apply ( element , args ) ; } ; if ( ! listeners [ event ] ) { listeners [ event ] = { } ; } if ( listeners [ event ] [ listener ] ) { element . removeEventListener ( event , listeners [ event ] [ listener ] , options ) ; } listeners [ event ] [ listener ] = _handler ; element . listeners = listeners ; } element . addEventListener ( event , _handler , options ) ; } ) ; }
Add event listener to the target element.
@param {Element} element - The event target.
@param {string} type - The event type(s).
@param {Function} listener - The event listener.
@param {Object} options - The event options.
Add event listener to the target element .