aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.norg3
-rw-r--r--examples/form/signup.css6
-rw-r--r--src/eval.ts8
3 files changed, 14 insertions, 3 deletions
diff --git a/TODO.norg b/TODO.norg
index 8be3a55..3d052cf 100644
--- a/TODO.norg
+++ b/TODO.norg
@@ -5,8 +5,9 @@
- (x) re-quotify value
- (x) analog + digital clock example
- (x) error handling try
- - ( ) Scoped catch on try
+ - (x) Scoped catch on try
- ( ) `do` expression
+ - ( ) `let` expression
- ( ) `has-class`
- ( ) `add-class` & `remove-class` should use self if id is not specified?
- ( ) Update `--cssx-text` on update
diff --git a/examples/form/signup.css b/examples/form/signup.css
index 3811c42..2335334 100644
--- a/examples/form/signup.css
+++ b/examples/form/signup.css
@@ -30,11 +30,13 @@
prevent-default()
add-class(form, 'submitting')
try(
- request('https://jksldjflksdjlfsd.com/wow'),
+ do(
+ request('/examples'),
+ add-class(form, 'submitted')
+ ),
js-eval(string('alert("', get-var(--error), '")'))
)
remove-class(form, 'submitting')
- add-class(form, 'submitted')
;
--cssx-children: input#input-email input#input-password #actions #message;
diff --git a/src/eval.ts b/src/eval.ts
index 17e27b1..1b5aace 100644
--- a/src/eval.ts
+++ b/src/eval.ts
@@ -332,6 +332,14 @@ const getFunctions = (
}
},
+ do: async () => {
+ let result = EvalValue.Void()
+ for (const expr of args) {
+ result = await evalExpr(expr, actions)
+ }
+ return result
+ },
+
_: () => Promise.reject(new Error(`Not implemented: ${name}`)),
})
}