Sencha Ext.define使用与需求 [英] Sencha Ext.define Uses vs Requires
本文介绍了Sencha Ext.define使用与需求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Ext.define('...', {
uses: ['...'],
});
和
Ext.define('...', {
requires: ['...'],
});
我有点困惑...他们有共同点吗?我们什么时候使用一个或另一个?
I am a bit confused...Do they have common ground at all? When do we use one or the other?
推荐答案
这个文件几乎涵盖了:
使用是可选的类依赖关系,由类使用,但不是
。这些可以异步加载,并且
必须可用于要实例化的类。
Uses are optional class dependencies that are used by, but not required by, a class. These can be loaded asynchronously and do not have to be available for the class to be instantiated.
例如,如果这是你的类在构造函数中实例化Foo的东西,那么它应该在需要
。
For example, if it's something your class instantiates Foo in the constructor, then it should be in requires
.
如果它实例化了Foo某些方法可能会被开发人员稍后调用,可以在中使用
。
If it instantiates Foo in some method that might get called later by the developer, it could go in uses
.
这篇关于Sencha Ext.define使用与需求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文