Expand description
App-lifecycle support for the backend compiled into THIS binary (docs/lifecycle.md).
Register handlers with on_lifecycle; guard phases a platform may not deliver either at runtime
(if day::lifecycle::supported(p) { … }) or at compile time with require_lifecycle!.
Enums§
- Lifecycle
- An app-lifecycle phase (docs/lifecycle.md). Each backend maps these onto its OS’s native app /
activity delegate. Some phases only exist on some platforms — a mobile app truly enters the
background and can be low on memory, a desktop app essentially cannot — so
Lifecycle::is_universalmarks the ones every backend delivers, andToolkit::supports_lifecyclereports per-backend truth.
Functions§
- lifecycle_
supported - Does the running backend deliver
phase? Use this to guard registration at runtime:if day::lifecycle_supported(Lifecycle::DidEnterBackground) { on_lifecycle(...) }. - on_
lifecycle - Register
fto run whenever the app reachesphase. Handlers run in registration order, in a reactive batch (signal writes coalesce into one UI update). Register early — beforelaunch, or at the top of the root builder — soWillLaunch/DidLaunchhandlers are in place when they fire. - supported
- Does the backend compiled into this binary deliver
phase? Aconst fn, so it drives both a runtime guard and the compile-timecrate::require_lifecycle!assertion. Agrees with the runtimeday_core::lifecycle_supportedonce the app is running.