Skip to content

Commit

Permalink
feat: add novo evento (htmx:newTab) para htmx
Browse files Browse the repository at this point in the history
  • Loading branch information
WellingtonNico committed Feb 20, 2024
1 parent 9fe545d commit 7859428
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wellnotify.htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class WellNotifyHTMX {
afterRequest: "htmx:afterRequest",
formValid: "htmx:formValid",
formInvalid: "htmx:formInvalid",
newTab: "htmx:newTab",
};

htmxWellNotifyAtributos = {
Expand Down Expand Up @@ -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

Expand All @@ -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");
});
}

/**
Expand Down

0 comments on commit 7859428

Please sign in to comment.