You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently this plugin creates many timeout intervals, but all of them work at exactly the same period. This is suboptimal. Much better would be that depending on the current timestamp a next update interval would be computed. For example, if it is displayed "1 hour ago" you know that for next hour you do not have to update at all. So you can create a timeout which will be called in an hour. I think this is much better than having one global timeout which goes all around and checks everything again and again (what others are proposing). It is much better to have timeouts for each timestamp, but just not call them with static period. Timeouts are effective then and it is left to the browser to call them when needed. The solution is just to tell the browser when exactly this will be.
This is a reasonable suggestion, and I agree that the suggestions from others for a global timeout isn't a huge performance improvement, but there are some potentially nice side effects and some elegance in simplicity of using a global timeout. This probably isn't something that I'll look into until a Timeago 2 rewrite happens (it's in my head, but not planned anytime soon).
Currently this plugin creates many timeout intervals, but all of them work at exactly the same period. This is suboptimal. Much better would be that depending on the current timestamp a next update interval would be computed. For example, if it is displayed "1 hour ago" you know that for next hour you do not have to update at all. So you can create a timeout which will be called in an hour. I think this is much better than having one global timeout which goes all around and checks everything again and again (what others are proposing). It is much better to have timeouts for each timestamp, but just not call them with static period. Timeouts are effective then and it is left to the browser to call them when needed. The solution is just to tell the browser when exactly this will be.
I implemented something like this in the past and it worked great.
The text was updated successfully, but these errors were encountered: