Blazored / Toast

A JavaScript free toast library for Blazor and Razor Component applications
https://blazored.github.io/Toast/
MIT License
663 stars 92 forks source link

[Question] is there something like a global Toast.OnShowComponent event? #152

Closed dirething closed 1 year ago

dirething commented 2 years ago

I had kind of taken a guess that if I went into the mainlayout where I have:

<BlazoredToasts Position="ToastPosition.BottomRight" MaxToastCount="3" Timeout="10" IconType="IconType.FontAwesome" SuccessClass="success-toast-override" SuccessIcon="fa fa-thumbs-up" />

and added something like the following to the code behind:

        protected override void OnAfterRender(bool firstRender)
        { Toast.OnShowComponent += Toast_OnShowComponent; }

that the Toast_OnShowComponent would get called by any toast on any page.

I think I understand now why that is wrong, but it does work for toasts issued from that page.

Is there a way to do this that I am missing?

chrissainty commented 1 year ago

This isn't a supported scenario and the show and hide events are for internal use only.