runExtensionsMethod = (
  action,
  vars,
  returnArray
) => {
  let result = returnArray ? [] : false
  for (const [name, ext] of Object.entries(svgCanvas.getExtensions())) {
    if (typeof vars === 'function') {
      vars = vars(name) // ext, action
    }
    if (ext.eventBased) {
      const event = new CustomEvent('svgedit', {
        detail: {
          action,
          vars
        }
      })
      document.dispatchEvent(event)
    } else if (ext[action]) {
      if (returnArray) {
        result.push(ext[action](vars))
      } else {
        result = ext[action](vars)
      }
    }
  }
  return result
}
@todo Consider: Should this return an array by default, so extension results aren't overwritten?
@todo Would be easier to document if passing in object with key of action and vars as value; could then define an interface which tied both together
@function module:svgcanvas.SvgCanvas#runExtensions
@param {"mouseDown"|"mouseMove"|"mouseUp"|"zoomChanged"|"IDsUpdated"|"canvasUpdated"|"toolButtonStateUpdate"|"selectedChanged"|"elementTransition"|"elementChanged"|"langReady"|"langChanged"|"addLangData"|"workareaResized"} action
@param {module:svgcanvas.SvgCanvas#event:ext_mouseDown|module:svgcanvas.SvgCanvas#event:ext_mouseMove|module:svgcanvas.SvgCanvas#event:ext_mouseUp|module:svgcanvas.SvgCanvas#event:ext_zoomChanged|module:svgcanvas.SvgCanvas#event:ext_IDsUpdated|module:svgcanvas.SvgCanvas#event:ext_canvasUpdated|module:svgcanvas.SvgCanvas#event:ext_toolButtonStateUpdate|module:svgcanvas.SvgCanvas#event:ext_selectedChanged|module:svgcanvas.SvgCanvas#event:ext_elementTransition|module:svgcanvas.SvgCanvas#event:ext_elementChanged|module:svgcanvas.SvgCanvas#event:ext_langReady|module:svgcanvas.SvgCanvas#event:ext_langChanged|module:svgcanvas.SvgCanvas#event:ext_addLangData|module:svgcanvas.SvgCanvas#event:ext_workareaResized|module:svgcanvas.ExtensionVarBuilder} [vars]
@param {boolean} [returnArray]
@returns {GenericArray<module:svgcanvas.ExtensionStatus>|module:svgcanvas.ExtensionStatus|false} See {@tutorial ExtensionDocs} on the ExtensionStatus.