@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Class JsonPlaceholderDatasource<T>

    Lazy page-cached datasource for JSONPlaceholder resources.

    Storybook/demo utility only. Not intended for production application data access. Uses _page (1-based) and _limit; total rows are read from x-total-count header.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Type Parameters

      • T

      Parameters

      • resource: "posts" | "comments" | "photos"
      • pageSize: number = INITIAL_PAGE_SIZE
      • fetchFn: {
            (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
            (input: string | Request | URL, init?: RequestInit): Promise<Response>;
        } = defaultFetch
          • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
          • Parameters

            • input: RequestInfo | URL
            • Optionalinit: RequestInit

            Returns Promise<Response>

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

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

            Returns Promise<Response>

      Returns JsonPlaceholderDatasource<T>

    Methods

    • Returns the total number of items, synchronously or asynchronously.

      Returns number | Promise<number>

    • Returns the row object at the given index.

      Parameters

      • rowIndex: number

        Zero-based index of the row to retrieve.

      Returns RowResult<T>

      The row value, or a Promise that resolves to it.