I am trying to use retina.js with Ember and I'm running into a problem. Retina.js will swap out img elements with a @2x version if it exists and only does so once when the page is refreshed. Apparently I can loop through img elements and create a new RetinaImage instance for AJAX responses, which seems to work for rendering of Ember views as well but the problem is that it does it twice when the page is initially loaded. I've looked into didInsertElement but it fires when the view is inserted AND rerendered. Is there a way to only limit the new RetinaImage(this) to view rerenders?
Relevant code:
Ember.View.reopen({
didInsertElement: function() {
this._super();
$('img').each(function() {
new RetinaImage(this);
});
}
});