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
I like the idea of just having to initialize $('body').timeago(); one time globally and then it keeps track of everything automatically but that only seems to work in a limited manner.
I know there is $('body').timeago('refresh'); for scenarios I am talking about but I seem to having issue with my ember.js app (see http://emberjs.com ), which also doesn't seem to be too easy to solve on the ember-side alone.
Basically I have a full JS frontend app, which dynamically loads data from an API. And that is where the issue starts: We have a user-profile, which dynamically loads timestamps from the server for posts. Ember.js doesn't seem to have an event-hook for when it populates the 'datetime' attribute.
To cut straight to the chase, would it be possible to implement some observer that automatically keeps track of programatically inserted/changed attributes at an unknown time?
I would obviously be willing to help, but I am also not quite sure how much time I will have available to do this all by myself.
At some of these implementations I am worried about performance (with the setInterval implementation). But in any case, let me know what you think and if I should look a bit more into it.
The text was updated successfully, but these errors were encountered:
This repo already does a great job IMO with its $('body').timeago() and $('body').timeago('refresh'); methods. I was able to quickly get it to update (in a performant way -- unlike jquery-timeago) on a single page app using Backbone. The key is to just setup your app so that some event is triggered when you render any new view that might contain timeagos, so that you call refresh at those times. For me that looks like:
I like the idea of just having to initialize
$('body').timeago();
one time globally and then it keeps track of everything automatically but that only seems to work in a limited manner.I know there is
$('body').timeago('refresh');
for scenarios I am talking about but I seem to having issue with my ember.js app (see http://emberjs.com ), which also doesn't seem to be too easy to solve on the ember-side alone.Basically I have a full JS frontend app, which dynamically loads data from an API. And that is where the issue starts: We have a user-profile, which dynamically loads timestamps from the server for posts. Ember.js doesn't seem to have an event-hook for when it populates the 'datetime' attribute.
To cut straight to the chase, would it be possible to implement some observer that automatically keeps track of programatically inserted/changed attributes at an unknown time?
I would obviously be willing to help, but I am also not quite sure how much time I will have available to do this all by myself.
The things I have found so far, if you are interested:
http://darcyclarke.me/development/detect-attribute-changes-with-jquery/
http://stackoverflow.com/questions/4561845/firing-event-on-dom-attribute-change
https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Events/Mutation_events
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver?redirectlocale=en-US&redirectslug=DOM%2FMutationObserver
http://www.w3.org/TR/DOM-Level-3-Events/
At some of these implementations I am worried about performance (with the setInterval implementation). But in any case, let me know what you think and if I should look a bit more into it.
The text was updated successfully, but these errors were encountered: