I think we all agree that this is a nice idea.
So, we remove the injector.register() method, and instead, we assume that every exported symbol in a module is available to the injector by name. So a module a.js:
class Something {}
export var something = Something;
and bootstrap:
injector.require('something', './a');
then injector.resolve('something') will do a require('./a') and then get 'something' from the returned module.
By the way, exported symbols that are not mentioned in the bootstrap will not be available, because the injector won't know in which module to look for them, which is a Good Thing.
Commands
Commands are made available through injector.registerCommand. This can also be removed and let the injector look for commands in a specially named exported variable, e.g.:
export var $commands = {
"test|ios": TestIosCommand,
"test|android": TestAndroidCommand
};
So, now the injector will look for the command implementation in module.$commands[commandName]
I think we all agree that this is a nice idea.
So, we remove the injector.register() method, and instead, we assume that every exported symbol in a module is available to the injector by name. So a module
a.js:and bootstrap:
then
injector.resolve('something')will do arequire('./a')and then get 'something' from the returned module.By the way, exported symbols that are not mentioned in the bootstrap will not be available, because the injector won't know in which module to look for them, which is a Good Thing.
Commands
Commands are made available through
injector.registerCommand. This can also be removed and let the injector look for commands in a specially named exported variable, e.g.:So, now the injector will look for the command implementation in
module.$commands[commandName]