Giter Club home page Giter Club logo

Comments (9)

sagacity avatar sagacity commented on July 26, 2024

You are right, the main reason is to avoid problems during minification or bundling. The reason it's not implemented is because I simply did not yet have the need for it.

One thing that would have to be decided is what to do with the abbreviation for the nullable facility (since ? is not a valid part of the name),

from intravenous.

seanhess avatar seanhess commented on July 26, 2024

Gotcha. No worries. I already wrote a function that wraps the function and sets $inject based on the parameter names. I think it should be optional.

In coffee-script the following would be equivalent:

# before
MyClass = (something) ->
MyClass.$inject = ["something"]

# after
MyClass = autoInject (something) ->

So you could start with autoInject for lots of things, but if you needed to use an optional dependency you could use the $inject syntax.

from intravenous.

sagacity avatar sagacity commented on July 26, 2024

Yes, that sounds like a reasonable solution. I'd want to specify the container though, so probably another method on the container object itself would be a good way to do it.

So instead of get you'd call autoGet or something.

from intravenous.

seanhess avatar seanhess commented on July 26, 2024

I'm ok with anything, or nothing: I can write something myself.

I'm not sure I understand your last comment. The func.$inject property is independent of the container, right? All I'd like is some way to automatically set the $inject property to match the parameter list of the function. It doesn't seem to have anything to do with the container.

But I can write something myself if you don't feel like adding it to the library. So either way. Thanks!

from intravenous.

sagacity avatar sagacity commented on July 26, 2024

Oh, so the autoInject just creates the $inject property instead of actually resolving the object? That's even simpler, yes. Maybe that would be a good candidate for inclusion in the core library.

from intravenous.

domenic avatar domenic commented on July 26, 2024

+1, getting started with Intravenous in Node.js and missing this.

from intravenous.

seanhess avatar seanhess commented on July 26, 2024

@domenic Sorry to hijack intravenous' thunder, because it's an awesome framework, but we ended up rolling our own. https://github.com/idottv/dependable - it's not as powerful as intravenous, but it injects based on the name

from intravenous.

sagacity avatar sagacity commented on July 26, 2024

Thunder stolen! :)
Seriously though, it's worth including. I finally have some more time to work on it, so hopefully I can add it asap.

Now, if only I can find out how to restrict @seanhess 's IP range from using it...

from intravenous.

seanhess avatar seanhess commented on July 26, 2024

Haha... Take whatever you want from our code of course if it helps.

from intravenous.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.