Skip to content

1681-engine / index / runDue

Function: runDue() ​

ts
function runDue<T>(
   scheduled, 
   scratch, 
   now, 
   failed
): void;

Defined in: src/core/runDue.ts:15

Runs and removes every call of scheduled due by now, in place: the list is compacted and scratch (kept by the caller, empty between calls) collects the due ones, so a frame allocates nothing. A call that throws goes to failed and the rest still run; whatever happens the due calls are gone from both lists afterwards. A list that kept a thrower threw again every frame anything else was scheduled, and cut short whatever the frame ran after it. A call scheduled by a running one lands in scheduled and waits for the next pass, even if already due.

Type Parameters ​

Type Parameter
T extends DueCall

Parameters ​

ParameterType
scheduledT[]
scratchT[]
nownumber
failed(err) => void

Returns ​

void

Released under the MIT License.