-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
option to run dotnet on worker thread #94
Conversation
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 39 45 +6
Lines 1073 1193 +120
Branches 131 133 +2
==========================================
+ Hits 1073 1193 +120
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
After some testing I've figured worker interaction layer adds too much complexity and makes debugging harder. It'll make more sense and will probably be more performant to use threading on C# side (#79). |
When using dotnet as application backend, it makes sense to run the process on a background thread to prevent stalling the main (UI) thread. Enabling
CreateWorker
build property will make dotnet run on worker thread and provide a mechanism to interact with the worker using the same APIs (via embedded comlink library):The dotnet web worker will start under the hood when the library is imported; the runtime can then be booted and used the same way. The only exception are the sync APIs: as it's not possible to communicate with web workers in blocking manner, all the methods will return promise, even if they do not return task on C# side.
When unit-testing applications with dotnet worker, define
muteDotNetWorker
global property to disable the worker creation on library import. Check the React sample on setting the variable with jest.