当Ember.js加载完所有内容时,有没有办法得到回调? [英] Is there a way to get a callback when Ember.js has finished loading everything?
问题描述
我正在构建一个Ember.js应用程序,在渲染/加载所有内容后,我需要做一些额外的设置。
I am building an Ember.js app and I need to do some additional setup after everything is rendered/loaded.
有没有办法得到这样的回调?谢谢!
Is there a way to get such a callback? Thanks!
推荐答案
在Views上定义的可以重载的几个函数也将自动调用。这些包括willInsertElement(),didInsertElement(),afterRender()等。
There are also several functions defined on Views that can be overloaded and which will be called automatically. These include willInsertElement(), didInsertElement(), afterRender(), etc.
特别是我发现didInsertElement()有用的时间运行在常规对象中的代码 - 导向系统将在构造函数中运行。
In particular I find didInsertElement() a useful time to run code that in a regular object-oriented system would be run in the constructor.
这篇关于当Ember.js加载完所有内容时,有没有办法得到回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!