Stopwatch examples or help?


Hi there!

Does anyone have an example of a stopwatch built in ember? Something that displays times for minutes and seconds, and allows users to start, stop and reset?

I was able to find one example, but after replicating the component, was unable to determine how to actually get this to display and function on a page:


are you using the component to display the data?

//stopwatch-component.hbs {{timeElasped}}

<button {{action 'start'}}>Start</button>

<button {{action 'stop'}}>Stop</button>

<button {{action 'reset'}}>Reset</button>

//stopwatch-component.js actions: { start() { this.set(‘state’, ‘run’); this.incrementTimeElapsed(new Date()); },

stop() {
  this.set('state', 'pause');

reset() {
  this.set('state', 'reset');
  this.set('timeElapsed', 0);

hold() {
  this.set('lapTime', this.get('timeElapsed'));
  this.set('state', 'lap');

continue() {
  this.set('state', 'run');