I ended up creating define.js. This libary provides a simple ‘define’ and ‘require’ method. The ‘define’ uses the global object to hold the modules so they are also available in html handlers. Using the global object as the module list also allows us to treat third party libraries such as jQuery as dependencies.
The following example creates a module that depends on the domain.person module, jQuery and the window object. Since we are using the global to store modules, we can treat jQuery and window just like any other dependency we have defined.
Using the global object to hold modules also allows us to access them in html