implement lazy App.Ready event

This commit is contained in:
Gregor Biswanger
2020-05-24 22:00:32 +02:00
parent c552a04347
commit 39c3e92128
2 changed files with 20 additions and 10 deletions

View File

@@ -356,7 +356,24 @@ namespace ElectronNET.API
/// <summary>
/// Emitted when the application has finished basic startup.
/// </summary>
public event Action Ready;
public event Action Ready
{
add
{
if(IsReady)
{
value();
}
_ready += value;
}
remove
{
_ready -= value;
}
}
private event Action _ready;
/// <summary>
/// Application host fully started.
@@ -370,7 +387,7 @@ namespace ElectronNET.API
if(value)
{
Ready?.Invoke();
_ready?.Invoke();
}
}
}