# CursorSource

`class` in `seedcord` · v0.15.0

<https://docs.seedcord.org/packages/seedcord/0.15.0/classes/cursor-source>

A source for a large or unknown-length set you fetch one page at a time (SQL LIMIT/OFFSET, a paged API). The fetcher receives the page index and the page size and reports whether a next page exists. A cursor source has no cheap total, so `totalPages` is undefined, the last button is omitted, and the indicator reads "Page X".

```ts
class CursorSource<Item> implements PageSource<Item>
```

## Constructors

### constructor

```ts
CursorSource(
    fetch: (
        ctx: PageContext,
        page: number,
        perPage: number
    ) => Promisable<{
        items: readonly Item[];
        hasNext: boolean;
    }>,
    opts?: { perPage?: number }
)
```

Constructs a new instance of the `CursorSource` class

## Methods

### page

```ts
public async page(
    ctx: PageContext,
    n: number
): Promise<PageView<Item>>
```
