Didn't thought about it 👍, do you have an example of implementation ?
async function* paginate(current) { const url = new URL('/api/data', location.href); while (1) { url.searchParams.set('from', current); const res = await fetch(url.href); if (res.ok) { let j = await res.json(); let page = yield j.data; current = page == null ? j.next : page === -1 ? j.prev : j.next; } else { throw await (res.headers.get('content-type') === 'application/json' ? res.json() : res.text()); } } }
Although I'd recommend something almost totally different with skips and all, it's up to you.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Didn't thought about it 👍, do you have an example of implementation ?
Although I'd recommend something almost totally different with skips and all, it's up to you.