DevHarness Module
Driving Issie from outside it, for development and for automated checking.
Published as `window.issieDev` in a debug build, and reached from a terminal through
`scripts/drive.js`. It exists because the alternative - synthesising DOM events and reading
rendered text back - is both slow and wrong often enough to mislead: a click has to find the
right element, a wait has to guess how long a render takes, and text scraped from the DOM can
be a frame out of date while looking authoritative.
Four things, which is what that experience says are needed:
onNextRender when the update has been applied AND the view has run, so a caller can wait
for the app rather than for a stopwatch
send a named command, dispatched as the message the UI would have sent
state what the app currently is, as data rather than as rendered text
simRefs what is holding a simulation, which is the question the DOM cannot answer
`send` takes a NAME from a fixed table rather than a serialised Msg. A Msg is an F# union
carrying models, canvases and functions; nothing useful survives a round trip through JSON, and
a general dispatch-anything surface in a debug build is a hazard for the sake of messages
nobody wanted to send. Add a row to `commands` when a new one is needed - that is the point.
Functions and values
| Function or value | Description |
|
|
|
|
Full Usage:
renderDone ()
Parameters:
unit
|
Called from the view wrapper, after the view has produced its elements. The callbacks run on the next animation frame rather than immediately: the view returning means React has been given the new elements, not that the DOM holds them, and a caller waiting for a render wants the state it can then read to be the state it was waiting for.
|