本文介绍了放在哪里的onload code在RequireJs和骨干应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当仁不让的主干应用程序,我使用的是结构有所
One possibility is to use the RequireJS domReady plugin (it's available for download from their short plugins list): http://requirejs.org/docs/api.html#pageload
下面是他们给出的例子:
Here's the example they give:
require(['domReady'], function (domReady) {
domReady(function () {
//This function is called once the DOM is ready.
//It will be safe to query the DOM and manipulate
//DOM nodes in this function.
});
});
所以,那么你可以将其纳入正常的RequireJS结构,知道,无论是DOM加载和任何其他的依赖,你可能已经上市沿着它。
So then you can just incorporate it into your normal RequireJS structure, knowing that both the DOM is loaded plus any additional dependencies you might have listed alongside it.
这篇关于放在哪里的onload code在RequireJs和骨干应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!