/// Application-scoped lifecycle registration. /// /// Handlers registered here run after the last window requests close and before the process /// exits, while the GLib main loop is still spinning, so they may await. @MainActor public enum ApplicationLifecycle { /// Registers asynchronous teardown to run before the application exits. /// /// Handlers run sequentially in registration order. A handler registered from an /// `App.init()` therefore runs before the app's own `App.shutdown()`. /// /// - Parameter work: Teardown to perform. Must not itself close windows or quit the app. public static func onShutdown(_ work: @escaping @MainActor () async -> Void) { PorticoRuntime._register(work) } }