mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-26 17:02:31 +00:00
Replace static property with resolver service
This commit is contained in:
@@ -61,8 +61,16 @@
|
||||
/// </example>
|
||||
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<Task> onAppReadyCallback)
|
||||
{
|
||||
ElectronNetRuntime.OnAppReadyCallback = onAppReadyCallback;
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton<IAppReadyCallbackResolver>(_ => new AppReadyCallbackResolver(onAppReadyCallback));
|
||||
});
|
||||
|
||||
return UseElectronCore(builder, args);
|
||||
}
|
||||
|
||||
private static IWebHostBuilder UseElectronCore(IWebHostBuilder builder, string[] args)
|
||||
{
|
||||
// no matter how this is set - let's unset to prevent Electron not starting as expected
|
||||
// e.g., VS Code sets this env variable, but this will cause `require("electron")` to not
|
||||
// work as expected, see issue #952
|
||||
|
||||
Reference in New Issue
Block a user