Created
January 12, 2012 16:58
-
-
Save ppcano/1601668 to your computer and use it in GitHub Desktop.
View get notified when its childviews has been inserted.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScrollMixin = Em.Mixin.create({ | |
didInsertElementEnd: function() { | |
this._setup_dimensions(); | |
this._super(); | |
} | |
.......... | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Em.View.reopen({ | |
didInsertElementEnd: Ember.K, | |
invokeRecursively: function(fn, end) { | |
fn.call(this, this); | |
this.forEachChildView(function(view) { | |
view.invokeRecursively(fn, end); | |
}); | |
if ( end ){ | |
end.call(this, this); | |
} | |
}, | |
_notifyDidInsertElement: function() { | |
this.invokeRecursively(function(view) { | |
view.didInsertElement(); | |
}, function(view) { | |
view.didInsertElementEnd(); | |
}); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment