xP: render date changes as they happen
This commit is contained in:
parent
c58b772905
commit
1079189381
@ -586,10 +586,24 @@ let Buffer = {
|
||||
vnode.state.controller = new AbortController()
|
||||
window.addEventListener('resize', event => Buffer.onupdate(vnode),
|
||||
{signal: vnode.state.controller.signal})
|
||||
|
||||
Buffer.setDateChangeTimeout(vnode)
|
||||
},
|
||||
|
||||
onremove: vnode => {
|
||||
vnode.state.controller.abort()
|
||||
clearTimeout(vnode.state.dateChangeTimeout)
|
||||
},
|
||||
|
||||
setDateChangeTimeout: vnode => {
|
||||
let midnight = new Date()
|
||||
midnight.setHours(24, 0, 0, 0)
|
||||
|
||||
// Note that this doesn't handle time zone changes correctly.
|
||||
vnode.state.dateChangeTimeout = setTimeout(() => {
|
||||
m.redraw()
|
||||
Buffer.setDateChangeTimeout(vnode)
|
||||
}, midnight - new Date())
|
||||
},
|
||||
|
||||
view: vnode => {
|
||||
|
Loading…
Reference in New Issue
Block a user