aolde / moduler.js

JavaScript library for binding modules to DOM elements.
http://aolde.github.io/moduler.js
MIT License
12 stars 3 forks source link

Reuse among modules #6

Open aolde opened 10 years ago

aolde commented 10 years ago

Come up with a ways to enable reuse between modules.

Example a Template module uses the Loader module to receive data from server, and then adds template functionality to the response.

Ping @robertvs

aolde commented 10 years ago

Maybe something like this. It does add a hard dependency to other modules though, which is something I have tried to avoid.

// register loader as a dependency
var moduleObj = moduler('template-loader', ['loader'], {
  init: function (module) {
    // can call method on dependency module
    module.loader.callSomeMethod();
  }
})