blob: a5bfc03cf42e8a3e5794d5f530cae618671339c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package vfd.dashboard.ui.instruments
import org.scalajs.dom
import rx._
import scala.scalajs.js.Date
import scalatags.JsDom.all._
class Clock extends Instrument[Date] {
def format(date: Date) = date.toLocaleTimeString()
val value = Var(new Date)
val element = span(format(value())).render
protected def update(value: Date) = {
element.innerHTML = format(value)
}
dom.setInterval(() => {value() = new Date}, 1000)
ready()
}
|