# ArraySource

`class` in `core` · v0.2.1

<https://docs.seedcord.org/packages/core/0.2.1/classes/array-source>

A source for a bounded list you can load whole. It loads the full list on every click, then slices the page via [`paginate`](/packages/core/0.2.1/functions/paginate), so the real total is known (a real last button, "Page X of Y"). Cache inside your loader if the load is expensive.

```ts
class ArraySource<Item, Ctx> implements PageSource<Item, Ctx>
```

## Constructors

### constructor

```ts
ArraySource(
    load: (ctx: Ctx) => Promisable<readonly Item[]>,
    opts?: { perPage?: number }
)
```

Constructs a new instance of the `ArraySource` class

## Methods

### page

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