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

How can I output an automatic timer using Handlebars?

$
0
0

@Rinchen wrote:

I've made a function which works as a timer and executes every second. When I console log the output of the function, it works fine, but it doesn't update graphically. This is my code:

In the model:

timer: function(){
   var model = this;
   return setInterval(function(){
      var start = model.get('startTime');
      var end = Date.now();
      var difference = end - start;
      console.log(difference);
      return difference;
 }, 1000);

In handlebars:

{{model.timer}}

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles