2018-06-19 21:50:37 +02:00
|
|
|
import { Container } from 'unstated'
|
|
|
|
|
|
|
|
export default class ClockContainer extends Container {
|
|
|
|
state = {
|
|
|
|
lastUpdate: 0,
|
|
|
|
light: false
|
|
|
|
}
|
|
|
|
constructor () {
|
|
|
|
super()
|
|
|
|
this.interval = setInterval(() => {
|
2018-12-17 17:34:32 +01:00
|
|
|
this.setState(state => ({ light: !state.light, lastUpdate: Date.now() }))
|
2018-06-19 21:50:37 +02:00
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
}
|