dispatchEventWithName_(name) {
    const event =
      /** @type {!CustomEvent} */(document.createEvent('CustomEvent'));
    event.initCustomEvent(name,
        /* canBubble= */ false,
        /* cancelable= */ false,
        /* detail= */ null);
    document.dispatchEvent(event);
  }
Dispatches a custom event to document.
@param {string} name
@private