mattbradley / livestampjs

A simple, unobtrusive jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements using Moment.js.
http://mattbradley.github.com/livestampjs
MIT License
409 stars 70 forks source link

Add customizable interval #10

Closed beaumartinez closed 11 years ago

beaumartinez commented 11 years ago

Once a minute is a sensible default, but I'd like it to be customizable as well—so we could update every five seconds on more "time-sensitive" data, for example.

mattbradley commented 11 years ago

It's not documented, but you can do this with the global interval() function. $.livestamp.interval() will return the current interval in seconds. $.livestamp.interval(x) will set the interval to x seconds.

beaumartinez commented 11 years ago

That's pretty sweet. Perhaps you should add it to the documentation?

Awesome project BTW.

97jaz commented 11 years ago

I'm not sure if commenting on a closed issue is a great idea, but... From looking at the code, it appears that the interval (unlike timestamps) are specified in milliseconds, not seconds. So the default behavior is to update once per second, not once per minute. And calling interval(x) sets the interval to x milliseconds. But maybe I'm missing something?