HOME


Mini Shell 1.0
Negocios La Pieza.DO | Registrate o Inicia Sesión

¡Página no encontrada!

La página que busca no se encuentra en nuestro servidor.

Volver al inicio
DIR: /var/www/devs.lapieza.net/node_modules/sweetalert2/src/staticMethods/
Upload File :
Current File : /var/www/devs.lapieza.net/node_modules/sweetalert2/src/staticMethods/bindClickHandler.js
let bodyClickListenerAdded = false
const clickHandlers = {}

/**
 * @param {string} attr
 */
export function bindClickHandler(attr = 'data-swal-template') {
  clickHandlers[attr] = this

  if (!bodyClickListenerAdded) {
    document.body.addEventListener('click', bodyClickListener)
    bodyClickListenerAdded = true
  }
}

const bodyClickListener = (event) => {
  for (let el = event.target; el && el !== document; el = el.parentNode) {
    for (const attr in clickHandlers) {
      const template = el.getAttribute(attr)
      if (template) {
        clickHandlers[attr].fire({ template })
        return
      }
    }
  }
}