I’ve got a Ember CLI based blog. I currently resize all <img>
inside posts upon clicking them using this function inside the application-controller.
I rely on on('init')
and Ember.run.later
and this feels just dirty.
How can I improve the subscription code below?
import Ember from 'ember';
export default Ember.ArrayController.extend({
imageScaling: function() {
Ember.run.later((function() {
//Subscribe to the actual event
Ember.$(".post-content img").on("click", function(){
// RESIZE HERE
})
}), 3000)
}.on('init')
});