Ember 2 best practices

I'm trying to find best practices for ember 2 related to class defining. I have a few questions...

  • Are we supposed to be using the ECMA6 "class", or does ember strictly rely on Ember.Object.extend?
  • If my class is not supposed to be an ember service does that auto make it a Utility?
  • Do all custom classes belong in Utility, or is it okay to create another folder for my classes?
  • More specifically my class is a wrapper for server sent events.


    Are we supposed to be using the ECMA6 "class", or does ember strictly rely on Ember.Object.extend?

    I find Ember.js to be a strict framework. But it does not strictly rely on Ember.Object.extend . You can use whatever you want that is valid Javascript. However, in my experience I would not try to re-implement too much stuff myself. Also, please note not inheriting from Ember.Object will prevent you from using these methods : http://emberjs.com/api/classes/Ember.Object.html.

    Do all custom classes belong in Utility, or is it okay to create another folder for my classes

    Why would you create a new folder ? Ember-cli already provides you with Services and Utilities.

    链接地址: http://www.djcxy.com/p/65820.html

    上一篇: NPM全球安装“找不到模块”

    下一篇: Ember 2最佳实践