KiteScriptEngine
A JavaScript engine for the scripts that documents carry: PDF JavaScript actions and document-level scripts today, EPUB scripting later.
KitePDF ships no engine of its own. Add kitepdf-javascript for one that runs on KiteJS, or implement this interface over another engine. Code that only needs to run scripts should take this interface, so it never depends on an engine directly.
Functions
Makes function callable from scripts under name, which may be a dotted path such as app.alert: missing objects on the way are created. Arguments arrive as Kotlin values (String, Double, Boolean, List, Map or null), and the return value goes back the same way. Binary data crosses as a ByteArray: an ArrayBuffer, a typed array or a DataView arrives as a copy of the bytes it views, and a returned ByteArray reaches the script as a Uint8Array.