Stone.js API
    Preparing search index...

    Interface ServerLoaderContext<EventType>

    Context handed to a server loader. Carries the request, the resolved auth token and cookies, an abort signal, a credentials-aware fetch, and the runtime side (server/client).

    interface ServerLoaderContext<EventType = unknown> {
        cookies: Record<string, string>;
        event: EventType;
        fetch: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | Request | URL, init?: RequestInit): Promise<Response>;
        };
        isClient: boolean;
        isServer: boolean;
        signal?: AbortSignal;
        token?: string;
    }

    Type Parameters

    • EventType = unknown

      The incoming event type.

    Index
    cookies: Record<string, string>

    Parsed request cookies.

    event: EventType

    The incoming event (request/intention).

    fetch: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | Request | URL, init?: RequestInit): Promise<Response>;
    }

    A fetch implementation (credentials-aware on the server).

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | Request | URL, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | Request | URL
        • Optionalinit: RequestInit

        Returns Promise<Response>

    isClient: boolean

    True in the browser.

    isServer: boolean

    True during server-side rendering.

    signal?: AbortSignal

    Abort signal to cancel the load (e.g. request aborted).

    token?: string

    Auth token resolved from the request (cookie/header), if any.