Coder Social home page Coder Social logo

Comments (7)

pleerock avatar pleerock commented on May 17, 2024

Api looks good. Btw is there a reason to call Container.create? I think no, because its extra operation which do not do anything - named container can be created when you put @Service with custom container name.

from typedi.

slavafomin avatar slavafomin commented on May 17, 2024

@pleerock Yes, I was thinking the same. I've replaced create() with get() above. Is it ok?

from typedi.

pleerock avatar pleerock commented on May 17, 2024

We were talking about separate containers to prevent "clear" method creation in tests, but we anyway endup doing that 🤣

All what we did - we created "named containers". I believe this feature will be rarely used.

I think instead of Container.get("container-name").get(Service) we just do Container.get(service: string|Function, containerName: string = "default")

from typedi.

pleerock avatar pleerock commented on May 17, 2024

do you have in plans to work on this issue? - so we can release everything together in next 0.5.0 version.

from typedi.

slavafomin avatar slavafomin commented on May 17, 2024

@pleerock I think we should leave it for now. I'm personally not requiring this functionality at the moment. Lets see if someone needs it. @ALL please feel free to vote on the first post in this thread.

from typedi.

pleerock avatar pleerock commented on May 17, 2024

This feature request was implemented and will be released in 0.6.0. Example of usage:

const controller1 = Container.of("mycontainer1").get(QuestionController);
controller1.save("Timber");
Container.reset("mycontainer1");

const controller2 = Container.of("mycontainer2").get(QuestionController);
controller2.save("Slava"); // different controller instance
Container.reset("mycontainer2");

from typedi.

github-actions avatar github-actions commented on May 17, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from typedi.

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.