Add Generic Lifecycle Events
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
The Application exposes methods to handle OnStart, OnSleep, & OnResume. It is technically possible to hook into these events if multi-targeting and providing native delegates for these Lifecycle Events. Since we already accept that these are platform agnostic events these should exist on the cross platform API for the LifecycleEvents builder.
### Public API Changes
This should be generally available on the net6.0 API so that it can be done generically to support any target without the need to explicitly provide a target for an individual platform.
```csharp
builder.ConfigureLifecycleEvents(lifecycle =>
{
lifecycle.OnStart(() => {
// My handler
});
lifecycle.OnSleep(() => {
// My handler
});
lifecycle.OnResume(() => {
// My handler
});
});
```
### Intended Use-Case
Provide handlers cross platform without the need for libraries like Prism to explicitly provide a compiled target for Android, iOS, Mac, Windows, Tizen, etc.
Contributor guide
Research direction
Start at the LifecycleEvents builder and the existing Application OnStart, OnSleep, and OnResume APIs. Trace how platform-specific lifecycle handlers are exposed, then verify that generic handlers can be registered through the net6.0 API and work for the three events without requiring a target platform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop-dev, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100