javascript - trigger jquery event every time ember renders or rerenders -
i need run function after every ember.js view render. initial thought run function once page ready view changes not affected dom manipulation in function. there way can bind event (or cause trigger) every time ember either renders view or re-renders view?
you hook didinsertelement
, there dom manipulations:
for example:
app.myview = ember.view.extend({ didinsertelement: function() { ember.run.scheduleonce('afterrender', this, 'processchildelements'); }, processchildelements: function() { // here dom manipulatins } });
edit in response last comment
if don't want hook didinsertelement
on per view basis, can dig deeper framework , reopen
ember.view
class, , hook render
function, after calling this._super(buffer);
view can it's job, or intercept renderbuffer
place there custom code:
ember.view.reopen({ render: function(buffer) { this._super(buffer); // funny stuff ... console.log(this.get('elementid')); } });
see here example (check console).
hope helps.
Comments
Post a Comment