Skip to content
Myr

Document pagination

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Closes #129

authored by Sindre Sorhus · committed by Sindre Sorhus · parent 0dd9522 · Browse files · 1 file+15 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−0 removed

  • other:+15 added−0 removed

1 file+15 added−0 removed

modified:readme.md+15 added
1540 unmodified lines
1541 console.log(event.data);1542}1543```15441545### Pagination15461547Use [`fetch-extras`](https://github.com/sindresorhus/fetch-extras) with Ky for paginating API responses:15481549```js1550import ky from 'ky';1551import {paginate} from 'fetch-extras';15521553const url = 'https://api.github.com/repos/sindresorhus/ky/commits';15541555for await (const commit of paginate(url, {fetchFunction: ky})) {1556 console.log(commit.sha);1557}1558```15591560### Extending types15611562Ky's TypeScript types are intentionally defined as type aliases rather than interfaces to prevent global module augmentation, which can lead to type conflicts and unexpected behavior across your codebase. If you need to add custom properties to Ky's types like `KyResponse` or `HTTPError`, create local wrapper types instead:1563
88 unmodified lines