-
-
Notifications
You must be signed in to change notification settings - Fork 741
Feat: Add Electron.NET startup lifecycle events #941
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
Closed
Denny09310
wants to merge
7
commits into
ElectronNET:develop
from
Denny09310:feature/electron-startup-options
Closed
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5434b0e
Merge pull request #936 from ElectronNET/develop
FlorianRappl 6600d12
Merge branch 'ElectronNET:develop' into develop
Denny09310 1d382c6
Merge branch 'ElectronNET:develop' into develop
Denny09310 98b421c
feat: added startup options for UseElectron
Denny09310 03c9b99
feat: added WebApplicationBuilder overload, removed Obsolete attribut…
Denny09310 2b227bb
Refactor runtime host initialization
Denny09310 c38d966
Merge pull request #1 from Denny09310/codex/remove-electronnetruntime…
Denny09310 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| namespace ElectronNET | ||
| { | ||
| using System; | ||
| using System.Threading.Tasks; | ||
|
|
||
| /// <summary> | ||
| /// Represents callbacks that are invoked during different phases of the Electron application | ||
| /// lifetime. These callbacks allow consumers to hook into the startup sequence more | ||
| /// granularly than the existing single callback. Callbacks return <see cref="Task"/> | ||
| /// enabling asynchronous work to be awaited before the next phase of the Electron runtime | ||
| /// commences. | ||
| /// </summary> | ||
| public class ElectronAppLifetimeEvents | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the callback that is invoked once the Electron process and socket bridge | ||
| /// have been established but before the Electron <c>ready</c> event has been | ||
| /// acknowledged. Use this hook to register custom protocols or perform other | ||
| /// initialization that must occur prior to the <c>ready</c> event. | ||
| /// </summary> | ||
| public Func<Task> OnBeforeReady { get; set; } = () => Task.CompletedTask; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the callback that is invoked when the Electron <c>ready</c> event is | ||
| /// fired. Use this hook to create browser windows or perform post-ready initialization. | ||
| /// </summary> | ||
| public Func<Task> OnReady { get; set; } = () => Task.CompletedTask; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the callback that is invoked when the Electron process is about to quit. | ||
| /// This maps to the <c>will-quit</c> event in Electron and can be used to perform | ||
| /// graceful shutdown logic. The default implementation does nothing. | ||
| /// </summary> | ||
| public Func<Task> OnWillQuit { get; set; } = () => Task.CompletedTask; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the callback that is invoked when the Electron process has fully | ||
| /// terminated. This can be used for cleanup tasks. The default implementation does | ||
| /// nothing. | ||
| /// </summary> | ||
| public Func<Task> OnQuit { get; set; } = () => Task.CompletedTask; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| namespace ElectronNET | ||
| { | ||
| /// <summary> | ||
| /// Provides configuration options for Electron.NET. Consumers can assign | ||
| /// an instance of <see cref="ElectronAppLifetimeEvents"/> to the <see cref="Events"/> | ||
| /// property to hook into the Electron application lifecycle. Additional | ||
| /// configuration properties can be added to this class in future versions without | ||
| /// breaking existing consumers. | ||
| /// </summary> | ||
| public class ElectronNetOptions | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the collection of lifecycle callbacks. The default value is | ||
| /// an instance of <see cref="ElectronAppLifetimeEvents"/> with no-op | ||
| /// implementations. Assigning a new instance or modifying individual | ||
| /// callbacks allows consumers to customize the startup sequence. | ||
| /// </summary> | ||
| public ElectronAppLifetimeEvents Events { get; set; } = new ElectronAppLifetimeEvents(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.