You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i'm fairly new to blazor so i'm sorry if this is an obvious question.
I'm wondering what the best practice if subscribing and unsubscribing to events from an injected service in a blazor component.
i have a ILogger service and a LogView component, in the component i subscribe to the event like this:
First of all, is that the "right" way to do it? (it seems to be from the examples i've seen), but secondly, where should i unsubscribe from the event? There is no Hide or Stop type method that i've seen that's called when the component should stop updating itself.
Or are the event subscriptions cleaned up some other way? i have a custom proxy thing that's using weakreferences for this purpose, but if i remember correctly from netFX, regular events do not work like that right?
The text was updated successfully, but these errors were encountered:
Hello, i'm fairly new to blazor so i'm sorry if this is an obvious question.
I'm wondering what the best practice if subscribing and unsubscribing to events from an injected service in a blazor component.
i have a
ILogger
service and aLogView
component, in the component i subscribe to the event like this:First of all, is that the "right" way to do it? (it seems to be from the examples i've seen), but secondly, where should i unsubscribe from the event? There is no
Hide
orStop
type method that i've seen that's called when the component should stop updating itself.Or are the event subscriptions cleaned up some other way? i have a custom proxy thing that's using weakreferences for this purpose, but if i remember correctly from netFX, regular events do not work like that right?
The text was updated successfully, but these errors were encountered: