Vinyl
    Preparing search index...

    Interface NetworkState

    Online status.

    interface NetworkState {
        onLine: boolean;
        hasAnyListeners(): boolean;
        hasListeners(type: keyof NetworkStateEventMap): boolean;
        nextOnLine(abort?: Maybe<ReadonlyAbort>): Promise<void>;
        on<K extends keyof NetworkStateEventMap>(
            type: K,
            handler: EventHandler<NetworkStateEventMap[K]>,
            options?: SignalOptions,
        ): Unsubscribe;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    onLine: boolean

    Returns the online status of the browser.

    Methods

    • Returns true if the event host has any listeners.

      Returns boolean

    • Returns a promise that resolves when the network state is next online. Rejects immediately if the given abortSignal is in an aborted state. Resolves immediately if the navigator is currently online.

      Parameters

      • Optionalabort: Maybe<ReadonlyAbort>

        If provided, rejects the returned promise when aborted.

      Returns Promise<void>