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