relative-time-element icon indicating copy to clipboard operation
relative-time-element copied to clipboard

RelativeTimeElement: Progressive time update intervals

Open nomego opened this issue 5 years ago • 0 comments

When updating nowElements, figure out how far away in time the nearest one is to ensure timely updates: If an element is within

  • one minute from now, update a second after last run
  • one hour from now - update a minute after last run
  • more than one hour from now - update 10 minutes after last run

Switching to setTimeout ensures that with a lot of attached instances, where a run might take a while, we won't schedule the next run until after all elements have been updated.

Also fire a relative-time-updated event if textContent changes in case this needs to be acted on.

nomego avatar Aug 13 '19 08:08 nomego