Jadelet Example Garden

Observables

Observables let Jadelet do its work. They hold a value and allow other parts of your code to subscribe to changes in that value. Jadelet templates automatically subscribe to observables so that when the value changes the template is updated without any rigamarole.

div
  button(click=@increment) Increment
  label= @count
Observable = Jadelet.Observable

buttonElement = Template
  count: Observable(0)
  increment: ->
    @count.increment()