resolve.js v0.0.1
Resolve.js
Resolve.js is my own alternative to AMD. It's practically a CommonJS module system, but for the browser. AMD leans on lazy-loading it's modules on the downloading phase, while this may be suitable throughout development, it's not my thing. Resolve.js lazy-loads on parsing and the execution of the Javascript - which take most of the time to complete. I have also included a build command that compiles everything into a single file (cake client-build
), which includes the loader and all the modules. Each module is named after it's file and path. (Note: Relative lookup is not yet implemented.)
// controller.js
var Controller, model;
model = require('model.js');
Controller = (function() {
function Controller() {
console.log("Controller constructor...");
this.model = model;
}
return Controller;
})();
module.exports = Controller;
This module would be named controller.js
, and can be aliased by just `controller. Future aliasing is planned and will allow you to define a module independently from it's filename.