Given a \'default\' Blazor app - created using the Visual Studio 2019 Blazor server template. How do you create a GLOBAL object that is acc
One way to do this is to is to use a singleton service that is injected into the components that allows event subscriptions. I discussed this with someone else a few days ago actually.
Check out this post for a discussion on dynamically updating pages from events fired out from a singleton, that updates across connections.
Here is a working demo that I adapted from another project I'm working on, when you run this project it instructs you to open another browser, copy / paste the URL, and has a running counter that updates and a text box to use to pass messages between pages. Enter something in the box, click the button, the counter updates on all pages from all connected clients and the message passes to all pages as well and displays. Works cross-browser and across connections.
A similar concept could be used to build up things like background notifications of long running tasks, user logon notifications, etc. Pretty flexible for my needs.