@graphty/graphty-element / extend / forEachChunked
Function: forEachChunked() ​
forEachChunked<
T>(context,phase,items,step):Promise<void>
Defined in: graphty-element/src/algorithms/results/types.ts:213
Walk a list in chunks, reporting progress between them and yielding once a frame's worth of work has built up (see YIELD_BUDGET_MS, a module constant; TypeDoc cannot link an unexported name).
Every per-element pass in every algorithm goes through this, so "report progress and yield" is one decision made once rather than a loop each author writes their own way.
Type Parameters ​
T ​
T
Parameters ​
context ​
RunControls
What the element gave the run.
phase ​
string
What to call this pass in a progress line.
items ​
readonly T[]
The elements to walk.
step ​
(item, index) => void
What to do with one element.
Returns ​
Promise<void>
A promise that settles when every element has been walked.