⌈⌋ ⎇ branch:  Bitrhythm


Artifact Content

Artifact 20a0821ce489eb995c5cf06672dab6b9ee67979edaca648f4ed3a2d9207e6ea2:


<timer>

  <p>Seconds Elapsed: { time }</p>

  this.time = opts.start || 0

  tick() {

    this.update({ time: ++this.time })

    if (this.opts.ontick) {
      this.opts.ontick(this.time)
    }

  }

  var timer = setInterval(this.tick, 1000)

  this.on('unmount', function() {

    clearInterval(timer)
  })

</timer>