Harvard-ATG/HarvardCards — pull request #41 by arthurian (2014-03-06 04:49:12+00:00)
Title: Experiment/js modules

This PR is an experiment that moves the inline javascript into separate modules. The modules live in `js/modules/` directory and are automatically loaded and initialized when they are included in the markup via `data-module="moduleName"`. Ideally, the modules should be light wrappers around the controllers, models, and views that are needed to render or add behavior to a section of the DOM. The only convention is that each module must return an object with an `initModule()` method (see the `js/modules/dummy.js` example).

The advantage to this approach is that it enforces a strict separation between the scripts from the markup. The disadvantage is that it's slightly more complex, and potentially slower since the module loader needs to parse the dom before the modules are loaded and executed.

I'm looking for feedback on whether this is a good approach or not.