Datastar can be used to write interactive, non-networked, applications.

  1. Bind a signal to the input
    input type="text" data-bind-calc
  2. Concat the button’s text to the signal
    button data-on-click="$calc=$calc.toString().concat('+')"
  3. Eval on click (don’t do this in a real app)
    button data-on-click="$calc=eval($calc).toString()"