Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 952 Bytes

requirejs-and-amd.md

File metadata and controls

30 lines (23 loc) · 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: