Closed Electrofenster closed 9 years ago
in such cases i insert the appropriate string into a span
element. i use frontend template rendering, so it's like this (in jade
template language):
span(data-livestamp=timeStamp.unix())
| #{timeStamp.fromNow()}
(assuming that timeStamp
is a moment
object).
@Electrofenster
Hmm, the update interval defaults to 1 second, so I'm surprised you're seeing 3-4 seconds.
You can manually trigger livestamp to update on demand for the new elements. If you are using the default data-livestamp
attributes, you can simply put a call to $.livestamp.update()
after updating DOM with .html(data)
in your $.get
callback.
Otherwise you can do it manually after selecting your new elements using $(...).livestamp()
.
See example: http://plnkr.co/edit/bFW8wYTKSo99W3xjmf8x
Let me know if this solves your issue so we can close.
Hello, I parse every 5 seconds an
li
viabut the string "5 minutes ago" loads 3-4secs later than the
li
:(Any solutions?