Open p0358 opened 6 years ago
I would like to see such changes:
loadTimes
inside setInterval
function - this may cause weird behavior if many trains should arrive in succession (eg. in 2, 4 and 6 seconds - it may result in three calls each canceling the preceding one),<tr>
and relevant <td>
elements along with actualRelativeTime
(maybe use td.dataset),className
), optionally on-demand (ie. compare what is generated with current value and setText
if required - but I am not sure how much of a performance hit will incur from not doing it, if any). This would also make should_activate_smooth_timer
obsolete.This would lower both number of modifications and additional code required - pretty much only function for setting status text and proper className should be extracted and used).
As you have stated - updating half of the DOM tree every second is no good.
It would also be unnecessary DOM updating every second without any visual change.
Thanks for the contribution!
Please review.