/** * @deijose/nix-ionic / lifecycle.ts — v2 * * Page-lifecycle plumbing identical to v1. The hooks (ionViewWillEnter, * ionViewDidEnter, ionViewWillLeave, ionViewDidLeave) still come from the * native element events — IonRouterOutlet attaches the listeners * when it creates each page. * * Nothing here needed to change for the single-router refactor. */ import type { Signal } from "@deijose/nix-js"; import { NixComponent } from "@deijose/nix-js"; export interface PageLifecycle { willEnter: Signal; didEnter: Signal; willLeave: Signal; didLeave: Signal; } export declare function createPageLifecycle(): PageLifecycle; /** * Internal symbol used by IonRouterOutlet's mount adapter to connect the * Ionic page lifecycle to an IonPage instance WITHOUT relying on the * subclass calling `super.onInit()`. The outlet calls this method directly * and stores the returned disposer so the watches are torn down with the view. */ export declare const _connectIonicLifecycle: unique symbol; /** * Class-based pages. Subclass and implement any of the hooks. * * class HomePage extends IonPage { * constructor(lc: PageLifecycle) { super(lc); } * ionViewWillEnter() { this.refreshData(); } * render() { return html`...`; } * } * * Lifecycle wiring no longer depends on `onInit()` / `super.onInit()`: * the router outlet calls the symbol-based `_connectIonicLifecycle` method * directly and disposes the watches when the view is cleaned up. Subclasses * may override `onInit` freely for their own setup without calling super. */ export declare abstract class IonPage extends NixComponent { private __lc; private __lifecycleDisposers; constructor(lc: PageLifecycle); /** * Connects the Ionic view lifecycle signals to this page's hooks. * Called once by the router outlet's mount adapter. Returns a disposer * that tears down all lifecycle watches. * * Idempotent: calling it more than once is a no-op after the first call. */ [_connectIonicLifecycle](): () => void; private _disposeLifecycle; ionViewWillEnter?(): void; ionViewDidEnter?(): void; ionViewWillLeave?(): void; ionViewDidLeave?(): void; } export declare function useIonViewWillEnter(lc: PageLifecycle, fn: () => void): () => void; export declare function useIonViewDidEnter(lc: PageLifecycle, fn: () => void): () => void; export declare function useIonViewWillLeave(lc: PageLifecycle, fn: () => void): () => void; export declare function useIonViewDidLeave(lc: PageLifecycle, fn: () => void): () => void;