File size: 528 Bytes
2471af3 | 1 2 3 4 5 6 7 8 9 10 11 | import { layoutGalaxy } from "./galaxy"
import type { Repo } from "./types"
// The force layout takes a second or two for ~1,300 bubbles; doing it here keeps the page responsive.
self.onmessage = (e: MessageEvent<{ key: string; repos: Repo[]; base: string; officialDl: number }>) => {
const { key, repos, base, officialDl } = e.data
const g = layoutGalaxy(repos, base, officialDl)
const pos = g.nodes.map((n) => [n.id, n.x, n.y, n.r, n.ring] as const)
self.postMessage({ key, pos, rings: g.rings, extent: g.extent })
}
|