caroso1222 / notyf

👻 A minimalistic, responsive, vanilla JavaScript library to show toast notifications.

Home Page:https://carlosroso.com/notyf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow adding of data attributes (for Turbo/Stimulus Reflex)

scottbarrow opened this issue · comments

When notfy is used with modern Multi page applications e.g. Rails, using Stimulus, Stimulus Reflex or Turbo - it is often required to have elements persist throughout page refreshes or DOM diff replacements.
Currently NotyfView adds the .notyf container dynamically when first instantiated, and only once, however this does not survive page reloads even through a memoized instance of Notyf would.
Therefore it's beneficial that the notyf element is able to survive DOM replacements by turbo or otherwise, this is accomplished with data-reflex-permanent, or data-turbo-permanent respectively. While these attributes can be added dynamically Notyf adds/removes this element seemingly at will

Would you be open to a PR that allows data attributes to be passed to the .notyf and .notyf-announcer container elements?