Skip to content

Webworkers and DI questions #20

Answered by LostBeard
pavel-zhur asked this question in Q&A
Discussion options

You must be logged in to vote
  1. In the web worker context, whatever I have in my Program.cs - does it actually get executed? Where I'm creating a builder, registering services, reading options, etc. Or does it just repeat the registrations in the webworker, dynamically reading them from the main DI at the time of creating a new web worker? What happens to the options and any custom code I have there?

Yes. Program.cs is loaded in a WebWorker context just like it does in a Window context. The main difference is caused by the change from RunAsync() call to BlazorJSRunAsync(). The BlazorJSRunAsync() method checks if it is working in a Window context and only calls RunAsync() if it is running in a Window context. This pr…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@LostBeard
Comment options

@LostBeard
Comment options

@pavel-zhur
Comment options

Answer selected by pavel-zhur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants