Closed geekdave closed 10 years ago
Would be nice to externalize the wiring like so:
src/user/UserContext.js
define([ "geppetto", "src/user/wiringConfig.js" ], function( Geppetto, wiringConfig ) { return Geppetto.Context.extend({ wiring: wiringConfig }); });
src/user/wiringConfig.js
define([ "src/users/commands/FooCommand.js", "src/users/commands/BarCommand.js", "src/users/foo.js", "src/users/qux.js" ], function( FooCommand, BarCommand, Foo, Qux ) { return { commands: { "appEventFoo": FooCommand, "appEventFooBarBaz": FooCommand }, singletons: { foo: Foo }, classes :{ bar: Bar }, values : { someValue: 10 }, views: { qux : Qux } } });
define([ "geppetto", "src/user/wiring/commands.js", "src/user/wiring/singletons.js", "src/user/wiring/classes.js", "src/user/wiring/values.js", "src/user/wiring/views.js" ], function( Geppetto, commandsConfig, singletonsConfig, classesConfig, valuesConfig, viewsConfig ) { return Geppetto.Context.extend({ wiring: { commands: commandsConfig, singletons: singletonsConfig, classes: classesConfig, values: valuesConfig, views: viewsConfig } }); });
src/user/wiring/commands.js
define([ "src/users/commands/FooCommand.js", "src/users/commands/BarCommand.js" ], function( FooCommand, BarCommand ) { return { "appEventFoo": FooCommand, "appEventFooBarBaz": BarCommand } });
src/user/wiring/singletons.js
define([ "src/users/foo.js" ], function( Foo ) { return { foo: Foo } });
I just tested, and this is already possible using the above examples. It's just plain ol' RequireJS functionality, with no special Geppetto features necessary. Closing.
Would be nice to externalize the wiring like so:
using a single wiringConfig file
src/user/UserContext.js
src/user/wiringConfig.js
using multiple config files
src/user/UserContext.js
src/user/wiring/commands.js
src/user/wiring/singletons.js