Ember.js and require.js

I am trying to recycle an unfinished ember application to use require.js

This is mainly the meaning of interest, and I began to study it when I wanted to use require-text for my steering patterns for convenience. Thus, I have not found that I am considering it for any kind of performance gain related to AMD, or something like that. But now I started to customize my module, defining modules that are easier for me to read, and would like to stick to it.

There is a question about the stack overflow when the request returned and published its data Ember.js and RequireJS , but none of the other examples, like the todo MVC example can be found in the links on how to optimally structure and link files in more complex applications.

One way or another, my question is: what rules should be followed in order to use JS correctly. What has he achieved (besides access to AMD)? It's hard for me to get around it with a test project that really doesn't require it, but I would like to learn the correct principles related to ember so that I can use it in the future.

I saw from the sample code that the idea might be to remove all references to global namespaces from modules. It's right? There are enough examples for me to find a sample.

At the moment, a file at the top level of my structure may have things like this in

<script>
define(['jquery',
    'app/controllers/mailshotlist',
    'app/controllers/sites',
    'ember'],
function($, MailShotList, Sites) {
  var App = Em.Application.create({
  Views: Em.Namespace.create(),
  Models: Em.Namespace.create(),
  Controllers: Em.Namespace.create(),
  init: function() {
    this._super();
    this.Controllers.set('Sites',Sites.create());
    this.Controllers.set('MailShotList',MailShotList.create({
      sitesControllerBinding: 'App.Controllers.Sites'
    }));   
  }
});
return window.App = App;
});
</script>

, app.x . , , . , , , .

, , AMD , , , ember js. , ember , .

, , "", ( ) , ,

+3
4

EmberJS RequireJS,

github EmberJS + RequireJS, https://github.com/fernandogmar/Emberjs-RequireJS

...

. !

+3

, emberjs/requirejs , . Ember script? no, MVC-? , ? requirejs emberjs requirejs , AMD. . AMD? requirejs , .

, ?

+2

@mpm, Ember.js + RequireJS AMD + RequireJS.

RequireJS Ember.js + RequireJS TodoMVC:

+1
source

All Articles