inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.12k stars 712 forks source link

Create a new instance from registered factory #1031

Open mindaugasnakrosis opened 5 years ago

mindaugasnakrosis commented 5 years ago

I am using inversify-vanillajs-helpers and trying to create a new instance for factory.

registerFactory('factory', context => () =>
    context.container.get('factory_class').create());

container.get('factory'); //[Function]

However, I get a function which I can not execute.

How to create a new instance from a registered factory using Javascript? (Not Typescript)

mindaugasnakrosis commented 5 years ago

@dcavanagh any ideas?

StuRuby commented 4 years ago

I have the same question...