UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

26 lines (25 loc) 765 B
import { data } from "./page-data.js"; const sleep = () => new Promise((res) => setTimeout(res, 600)); export async function Server(reqs, page, pageSize) { // Simulate latency and server work. await sleep(); const pageCount = Math.ceil(data.length / pageSize); const pageStart = page * pageCount; const pages = reqs.map((c) => { return { asOfTime: Date.now(), data: data.slice(pageStart, pageStart + pageSize).map((x) => { return { kind: "leaf", id: x.uniq_id, data: x }; }), start: c.start, end: c.end, kind: "center", path: c.path, size: pageSize, }; }); return { pages, pageCount, }; }