Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Remove global $injector #500

Open
Open

Description

@tailsu

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]

Activity

  1. ligaz commented on Oct 29, 2015

    @ligaz

    We can introduce a @Command("test|ios") decorator to annotate the commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions