Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (23 sloc) 952 Bytes

RequireJS and AMD

You may adopt a Asynchronous Module Definition-style method of organization using a library like RequireJS. This will allow you to organize your modules in the require(...) way familiar to those who use NodeJS.

If you adopt an AMD library, there will be no need to use namespaces for your JavaScript classes.

define(function(require) {
  var Photo = require('models/photo');
  var Photos = require('collections/photos');
  var MenuView = require('views/menu');
  var MainRouter = require('router/main');

  // ...
});

For more information on RequireJS, AMD, and using it on your Backbone project, see: