4

Loving riot js but why is "Hello 0" not incrementing on the page in the following code example, and what is the workaround for now?

<my-app>
    <p>Hello {myNumber}</p>
    this.myNumber = 0;
    var thisApp = this;
    setInterval(
        function(){
            thisApp.myNumber++;
        },
        1000
    );
</my-app>
Navigateur
  • 1,852
  • 3
  • 23
  • 39

1 Answers1

10

Inside the function add

thisApp.update();

There is no way to add and configure dirty checking in riot js, as of version 2.2.2-beta.

You don't need to call update() in the execution of your

  1. outermost script
  2. event functions executed via riot js html template expressions

...because riot js automatically calls update() after executing those.

Navigateur
  • 1,852
  • 3
  • 23
  • 39