Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4869

setInterval and @tracked

$
0
0

I don’t understand why whatTimeIsIt is not updating in the DOM. Ideas?

The timer is ticking, I can set a breakpoint in the console and I see that whatTimeIsIt is changing…

@tracked whatTimeIsIt

timerId = null

updateWhatTimeIsIt() {
    this.whatTimeIsIt = (new Date()).toISOString()
}

constructor() {
    super(...arguments)
    this.updateWhatTimeIsIt()
    this.timerId = setInterval(this.updateWhatTimeIsIt, 1000 )
}

The display doesn’t update

<div>
<div>Timer</div>
<div>{{this.whatTimeIsIt}}</div>
</div>

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4869

Trending Articles