Datastar can be used to write interactive, non-networked, applications.
- Bind a signal to the input
input type="text" data-bind-calc
- Concat the button’s text to the signal
button data-on-click="$calc=$calc.toString().concat('+')"
- Eval on click (don’t do this in a real app)
button data-on-click="$calc=eval($calc).toString()"