demo/dist/demo.js
function toggleListener(element, event, callback) {
	  var _this = this;

	  var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
	  var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
	  var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;

	  // Bail if no element, event, or callback
	  if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
	    return;
	  } // Allow multiple events


	  var events = event.split(' '); // Build options
	  // Default to just the capture boolean for browsers with no passive listener support

	  var options = capture; // If passive events listeners are supported

	  if (supportsPassiveListeners) {
	    options = {
	      // Whether the listener can be passive (i.e. default never prevented)
	      passive: passive,
	      // Whether the listener is a capturing listener or not
	      capture: capture
	    };
	  } // If a single node is passed, bind the event listener


	  events.forEach(function (type) {
	    if (_this && _this.eventListeners && toggle) {
	      // Cache event listener
	      _this.eventListeners.push({
	        element: element,
	        type: type,
	        callback: callback,
	        options: options
	      });
	    }

	    element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
	  });
	}
function toggleListener(element, event, callback) {
	  var _this = this;

	  var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
	  var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
	  var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;

	  // Bail if no element, event, or callback
	  if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
	    return;
	  } // Allow multiple events


	  var events = event.split(' '); // Build options
	  // Default to just the capture boolean for browsers with no passive listener support

	  var options = capture; // If passive events listeners are supported

	  if (supportsPassiveListeners) {
	    options = {
	      // Whether the listener can be passive (i.e. default never prevented)
	      passive: passive,
	      // Whether the listener is a capturing listener or not
	      capture: capture
	    };
	  } // If a single node is passed, bind the event listener


	  events.forEach(function (type) {
	    if (_this && _this.eventListeners && toggle) {
	      // Cache event listener
	      _this.eventListeners.push({
	        element: element,
	        type: type,
	        callback: callback,
	        options: options
	      });
	    }

	    element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
	  });
	}
function toggleListener ( element , event , callback ) { var _this = this ; var toggle = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : false ; var passive = arguments . length > 4 && arguments [ 4 ] !== undefined ? arguments [ 4 ] : true ; var capture = arguments . length > 5 && arguments [ 5 ] !== undefined ? arguments [ 5 ] : false ; // Bail if no element, event, or callback if ( ! element || ! ( 'addEventListener' in element ) || is$1 . empty ( event ) || ! is$1 . function ( callback ) ) { return ; } // Allow multiple events var events = event . split ( ' ' ) ; // Build options // Default to just the capture boolean for browsers with no passive listener support var options = capture ; // If passive events listeners are supported if ( supportsPassiveListeners ) { options = { // Whether the listener can be passive (i.e. default never prevented) passive : passive , // Whether the listener is a capturing listener or not capture : capture } ; } // If a single node is passed, bind the event listener events . forEach ( function ( type ) { if ( _this && _this . eventListeners && toggle ) { // Cache event listener _this . eventListeners . push ( { element : element , type : type , callback : callback , options : options } ) ; } element [ toggle ? 'addEventListener' : 'removeEventListener' ] ( type , callback , options ) ; } ) ; }
Toggle event listener
Toggle event listener