Composer.js

Building / load order

Generally, you should include the provided pre-packaged composer.js file for inclusion in your app, however you can mix and match or build your own by using the following load order:

  • util.js - Sets up any common Composer utilities
  • class.js - Houses the main class system
  • event.js - Composer’s eventing fabric
  • base.js - The Base object that all others extend
  • model.js - Model. Represents a piece of data (record).
  • collection.js - Collection. Represents a list of models (table).
  • adapter.js - The DOM abstraction used by Controllers
  • controller.js - Controller. Ties models/collections to the DOM.
  • listcontroller.js - ListController. Provides easy collection tracking.
  • router.js - The Router allows easy tracking of pushState.
  • relational.js - Relational model. Allows setting up hierarchies in data.
  • filtercollection.js - Filter collection. Allows setting up materialized views.

Dependencies

The full build of Composer requires History.js, as well as morphdom when using the xdom rendering system (although it’s possible to tie in your own DOM patching library if needed).

Here is the breakdown of which components rely on which (in Component: [Dep1, Dep2, ...] format):

  • Util: []
  • Class: [Util]
  • Event: [Class]
  • Base: [Event]
  • Model: [Base]
  • Relational model: [Model]
  • Collection: [Base, Model]
  • Filter collection: [Collection]
  • Adapter: [Util]
  • Controller: [Base, Adapter]
  • ListController: [Controller]
  • Router: [Base, History.js]