MELCloud & MELCloud Home API for Node.js - v48.2.0
    Preparing search index...

    Interface LifecycleEvents

    Callback bundle invoked around SDK lifecycle moments. All callbacks are optional and non-throwing — the SDK ignores any exceptions they raise so a buggy observer cannot break the request flow.

    Two scopes coexist here:

    • Per-request (onRequest*) — fires for every outgoing HTTP call.
    • Per-sync (onSyncComplete) — fires after each sync trigger (auto-timer OR a @syncDevices-decorated mutation), once the downstream device state has been refreshed.
    interface LifecycleEvents {
        onAuthenticationLost?: () => void;
        onAuthenticationRestored?: () => void;
        onRequestComplete?: (event: RequestCompleteEvent) => void;
        onRequestError?: (event: RequestErrorEvent) => void;
        onRequestRetry?: (event: RequestRetryEvent) => void;
        onRequestStart?: (event: RequestLifecycleContext) => void;
        onSyncComplete?: SyncCallback;
    }
    Index
    onAuthenticationLost?: () => void

    Fires when a previously-available session is definitively lost: the boot-time restore found persisted state but could not sign in, or a sync cycle ended unauthenticated after the 401-recovery chain gave up. The auto-sync disarms at the same moment (rescheduling would hammer the account with a doomed sign-in every cycle); a successful authenticate() — e.g. the user logging back in — re-arms it. Fires once per loss episode.

    onAuthenticationRestored?: () => void

    Fires when a sync cycle ends authenticated after an onAuthenticationLost episode — the user logged back in or a retry recovered the session. Fires once per loss episode, so the two events always alternate.

    onRequestComplete?: (event: RequestCompleteEvent) => void

    Invoked after a successful HTTP response is received.

    onRequestError?: (event: RequestErrorEvent) => void

    Invoked when a request fails permanently (retries exhausted).

    onRequestRetry?: (event: RequestRetryEvent) => void

    Invoked before each backoff-scheduled retry attempt.

    onRequestStart?: (event: RequestLifecycleContext) => void

    Invoked when a request is dispatched for the first time.

    onSyncComplete?: SyncCallback

    Invoked after each sync trigger (auto-timer or @syncDevices-decorated mutation). Receives the device-type filter and any IDs the cascade was scoped to.