Y
Y
Yaroslav2019-03-01 17:22:31
Node.js
Yaroslav, 2019-03-01 17:22:31

How to get an already created object instance in inversify JS without typescript on ES6?

Actually a subject.
Following the examples from the docs:

var container = new inversify.Container();
container.bind(TYPES.Ninja).to(Ninja);
var ninja = container.get(TYPES.Ninja)
var ninja2 = container.get(TYPES.Ninja)

ninja !== ninja2

And you need:
ninja === ninja2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav, 2019-03-01
@YarkoDzech

figured out

container.bind(TYPES.Ninja).to(Ninja).inSingletonScope()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question