-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choice between using Singleton or Scoped events #9
Comments
Sounds good to me. I think having the scoped events handled via injection makes sense. This way, it would not conflict with the micro frontend API (and events).
|
Hi, |
New Feature Proposal
Choice between using the global events or a "local" (scoped) version of the event handler.
Description
Having the need for scoped events to send/receive messages in a single users session and not all users at the same time.
As we know, Blazor server Singleton registration is shared for all circuits.
Not all use cases involve that, so a scoped version should be available as well.
Maybe something like having two interfaces ISingletonEvents, IScopedEvents and a class PiralEvents
PiralEvents : IScopedEvents, ISingletonEvents
Then in the registration:
services.AddScoped<IScopedEvents, PiralEvents>();
services.AddSingleton<ISingletonEvents, PiralEvents>();
Then in the component do:
@Inject IScopedEvents myEvents
or
@Inject ISingletonEvents myEvents
Should be flexible enough.
Thoughts?
Background
N/A
Discussion
N/A
The text was updated successfully, but these errors were encountered: