EpubScriptRunner

constructor(document: EpubDocument, policy: EpubScriptPolicy = EpubScriptPolicy(), onConsole: (level: String, message: String) -> Unit = { _, _ -> }, clock: () -> Long? = null, instanceKey: String? = null, fontOutlines: (text: String, font: FontSpec) -> KitePath?? = null)(source)

Parameters

onConsole

gets what scripts print with console, and what alert, confirm and prompt would have shown, on one of the runner's threads.

clock

milliseconds on a clock that only goes forward, for the timers, the budget and Date.now(). Leave it unset for the real one; a test sets it so a timer is repeatable.

instanceKey

a value the app keeps for its reader, such as an install id, which makes the book's origin one of this reader's copy (#521). Without one each runner has an origin of its own.

fontOutlines

the outline of a run of text in a host font, in glyph space as KiteCanvas.hostGlyphOutline answers it. A canvas's getImageData and toDataURL draw text with it. Without it, text reads back as blank.