New feature suggestion: Add callback on refresh to be able to modify element #60

Open
wants to merge 2 commits into
from

2 participants

@blmstr

Just added a simple callback function to be able to modify the time element on refresh. I use it to be able to style the date depending on the time. For example adding a class old if the time passed 10 minutes and such...

@delfuego

Wow, this would be awesome. I was coming here to request an event that got fired whenever an element was modified; either way, it'd be great to be able to monitor modifications of the timeago element so that actions can be fired off when the modification meets whatever criteria you're looking for.

(For me, I'm using timeago to show times in the future and in the past, and am looking for a way to know when one of them crosses from the future to the past. Right now, I'm using setInterval to run a script every 500ms that looks at all the timeago elements that contain 'ago' in them, and then making sure I handle those I haven't already discovered... but there HAS to be an easier way!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment