apendua/meteor-amd-manager — pull request #4 by chicagogrooves (2014-10-21 11:59:24+00:00)
Title: WIP Suggested api change - pass dependencies via context `this` object

One of the big complaints I hear about requireJs is the double-entry of dependencies as string names, and as function arguments to the module constructor:
````
define(['dep1', 'dep2'], function(dep1, dep2){ ... });
````
It seems that when `apply` is called with an empty object as the context on [line 128](https://github.com/apendua/meteor-amd-manager/blob/master/manager.js#L128), this is a chance where a fuller object could be passed.

I'd propose there would be camelCased variants of the dependency names directly on the context object, as well as exact-string lookups.
````
define(['dep1', 'fancy-dep'], function(){
test.equal(this.dep1, this['dep1']);
test.equal(this.fancyDep, this['fancy-dep']);
});
````
Alternately (or in addition), the factory function could be executed in a closure, providing access to the variables as below, but I consider that a bit too "magical", with the currently unused `this` object being a more idiomatic JavaScript way
````
define(['dep1'], function(){
// If you want to reference dependencies, grab them through `this`, or arguments, or require('dep1')
});

````

Let me know if this seems valuable - if not I'm happy to implement in a fork, if not.