[英]Is there a Dojo naming convention for classes?
Dojo documentation is using "/"
to declare a hierarchy between classes. Dojo 文档使用"/"
来声明类之间的层次结构。
define(["dojo/_base/declare"], function(declare){
return declare(null, {
constructor: function(name, age, residence){
this.name = name;
this.age = age;
this.residence = residence;
}
});
});
require(["my/Person"], function(Person){
var folk = new Person("phiggins", 42, "Tennessee");
});
But I found some code with my.Person
instead of /
and Webstorm Structure View is able to order classes when we use the .
但是我发现一些代码使用my.Person
而不是/
并且当我们使用.
. .
Do we have any naming convention for this ?我们对此有任何命名约定吗?
The dot (.)
separated pkg are used in version prior to 1.7 , in v > 1.7 its being replaced by slash ( /
)点(.)
分隔的 pkg 在 1.7 之前的版本中使用,在 v > 1.7 中,它被斜线 ( /
) 替换
require
replace the dojo.require
wich comes with those change . require
替换dojo.require
随这些更改一起出现。
If you read the Migration guide between 1.x and 1.7 you can see :如果您阅读 1.x 和 1.7 之间的迁移指南,您可以看到:
dojo.require takes a dot-separated module name, require() takes a forward-slash separated module name dojo.require 采用点分隔的模块名称,require() 采用正斜杠分隔的模块名称
So use only forward-slash for version 1.7 and next ...因此,仅对 1.7 版和下一个版本使用正斜杠...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.