aboutsummaryrefslogtreecommitdiff
path: root/src/eval.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.ts')
-rw-r--r--src/eval.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/eval.ts b/src/eval.ts
index 3a4e4f9..3d6734f 100644
--- a/src/eval.ts
+++ b/src/eval.ts
@@ -25,6 +25,8 @@ export interface EvalActions {
url: string
data: FormData | undefined
}): Promise<void>
+ addChildren(id: string, children: Expr[]): Promise<void>
+ removeElement(id: string | undefined): Promise<void>
// calculate ??
}
@@ -126,6 +128,15 @@ const getFunctions = (name: string, args: Expr[], actions: EvalActions) =>
}
},
+ 'add-children': async () => {
+ const id = await evalExpr(args[0], actions)
+ if (id) actions.addChildren(id, args.slice(1))
+ },
+ 'remove-element': async () =>
+ actions.removeElement(
+ (args[0] && (await evalExpr(args[0], actions))) ?? undefined,
+ ),
+
_: () => Promise.reject(new Error('not supposed to be here')),
})