Ember 命名/大小写约定 [英] Ember naming / capitalization convention

查看:25
本文介绍了Ember 命名/大小写约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照我的理解,我们鼓励将 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.create({});(谢谢@sly7_7 捕捉)

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-conventions.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆