function dispatchEvent(element, type, data, options) {
  var event;

  // Event and CustomEvent on IE9-11 are global objects, not constructors
  if (isFunction(Event) && isFunction(CustomEvent)) {
    event = new CustomEvent(type, _objectSpread2({
      bubbles: true,
      cancelable: true,
      detail: data
    }, options));
  } else {
    event = document.createEvent('CustomEvent');
    event.initCustomEvent(type, true, true, data);
  }
  return element.dispatchEvent(event);
}
Dispatch event on the target element.
@param {Element} element - The event target.
@param {string} type - The event type(s).
@param {Object} data - The additional event data.
@param {Object} options - The additional event options.
@returns {boolean} Indicate if the event is default prevented or not.