Ember命名/大小写公约 [英] Ember naming / capitalization convention
问题描述
我明白这一点,我们鼓励将Ember实例命名为小写:
The way I understand it, we are encouraged to name Ember instances lowercase:
App.mailtruck = Em.Object.create({...});
...和类大写:
App.Mailtruck = Em.Object.extend({...});
说Ember.Namespace的实例是这个规则唯一的例外是否正确?另外,除了命名空间之外,这个约定是非常重要的吗?
Would it be correct to say that instances of Ember.Namespace are the sole exception to this rule? Also, are there any cases besides Namespaces where this convention is strictly important?
推荐答案
是的,命名空间是这个规则的例外。正如你所说,它是 lowerCase
实例和 UpperCase
类。另外 Mixins
应该被命名为 UpperCase
,所以它是: App.LoggerMixin = Ember.Mixin。创建({});
(感谢@ sly7_7 为catch)
Yes, namespaces are the exception to this rule. As you said, it's lowerCase
instances and UpperCase
classes. Also Mixins
should be named UpperCase
, so it's: App.LoggerMixin = Ember.Mixin.create({});
(Thanks @sly7_7 for the catch)
更多详细信息可以在Emberist的伟大博客文章: http://www.emberist.com/ 2012/04/09 / naming-convention.html 。
Further details can be read in the great blog post by the Emberist: http://www.emberist.com/2012/04/09/naming-conventions.html.
这篇关于Ember命名/大小写公约的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!