@ue-too/being-portable / loadMachine
関数: loadMachine()
loadMachine(
document,host,options):LoadResult
定義: 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.
パラメータ
document
unknown
host
options
LoadOptions = {}
戻り値
例
ts
const result = loadMachine(JSON.parse(text), host);
if (!result.ok) return showErrors(result.errors);
result.machine.happens('insertCoin', { amount: 1 });