Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Handling long dependency lists?

$
0
0
I have a few modules which have long lists of dependencies, which we aren't planning to refactor yet. The normal steal('dependency1', 'dependency2', function(d1, d2) { ... }); syntax still works, but it's rather difficult to read with >10 dependencies.

RequireJS has some syntactic sugar for handling this case, but I haven't found an equivalent approach in StealJS -- is there one?


The closest I've found is to do something like
  1. steal('dependency1', 'dependency2', function(/* args are ignored */) {
  2.       var d1 = steal.Module.modules['dependency1'].value;
  3.       var d2 = steal.Module.modules['dependency2'].value;
  4.       // etc
  5. });
That makes it easier to match the local var name with the dependency name, but it feels very sketchy to me -- especially since we end up listing the dependencies twice.

Is there a better way to do this?


Viewing all articles
Browse latest Browse all 3491

Trending Articles