From 785942811edfddb521048c92cc80e78feea05ecb Mon Sep 17 00:00:00 2001 From: Wellington Date: Tue, 20 Feb 2024 09:35:16 -0300 Subject: [PATCH] feat: add novo evento (htmx:newTab) para htmx --- wellnotify.htmx.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wellnotify.htmx.js b/wellnotify.htmx.js index e3f6849..140ff14 100644 --- a/wellnotify.htmx.js +++ b/wellnotify.htmx.js @@ -38,6 +38,7 @@ class WellNotifyHTMX { afterRequest: "htmx:afterRequest", formValid: "htmx:formValid", formInvalid: "htmx:formInvalid", + newTab: "htmx:newTab", }; htmxWellNotifyAtributos = { @@ -83,8 +84,8 @@ class WellNotifyHTMX { wellNotifyInstance ); }); - document.addEventListener(this.eventos.WellNotifyInfo, (event) => { - this.dispararNotificacoes(event.detail.value, "info", wellNotifyInstance); + document.addEventListener(this.eventos.WellNotifyInfo, (e) => { + this.dispararNotificacoes(e.detail.value, "info", wellNotifyInstance); }); // permite as notificações pelos headers do htmx @@ -100,6 +101,9 @@ class WellNotifyHTMX { document.addEventListener(this.htmxEventos.formInvalid, (e) => this.formInvalid(e, wellNotifyInstance) ); + document.addEventListener(this.eventos.newTab, (e) => { + window.open(e.detail.value, "_blank"); + }); } /**