@ue-too/being-portable / loadMachine
Function: loadMachine()
loadMachine(
document,host,options):LoadResult
Defined in: being-portable/src/api.ts:53
Validates an untrusted document and builds its machine. Returns every error instead of a machine when the document is invalid.
Parameters
document
unknown
host
options
LoadOptions = {}
Returns
Example
ts
const result = loadMachine(JSON.parse(text), host);
if (!result.ok) return showErrors(result.errors);
result.machine.happens('insertCoin', { amount: 1 });