triggerDidCloseAndDispose = (instance, didClose) => {
  setTimeout(() => {
    if (typeof didClose === 'function') {
      didClose.bind(instance.params)()
    }
    globalState.eventEmitter?.emit('didClose')
    // instance might have been destroyed already
    if (instance._destroy) {
      instance._destroy()
    }
  })
}
@param {SweetAlert} instance
@param {Function} didClose