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

How about get by Function rather than key? #9

Description

@tusharmath

The Problem statement

If I want to retrieve an instance of MyCustomClass, I have to first register it with a key name. For that I will have to require this and all the other modules on startup. That means one file will have to require all the modules first and then initialize the application.

This seems in efficient and quite a headache to maintain that one file which contains all the required modules.

RATHER: How about requiring them in modules that actually need them instead

var Dep1 = require('./dep1');
var Dep2 = require('./dep2');

function MyCustomClass () {}
MyCustomClass.$inject = [Dep1, Dep2]; //Instead of using key name

So the main idea is to be able to query on the Class name rather than the key name. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions