Answer the question
In order to leave comments, you need to log in
Can you offer ideas/criticisms for the Di package API?
Briefly about the project: Container with service location and dependency injection.
Actually a link to the wiki on this very api - there are examples of specifying types for injection and declaring the behavior of "services": https://github.com/SerafimArts/DependencyInjecton/wiki
I do not want to duplicate, because it is quite a mile away.
class Some {
constructor(user: User, guard: BaseAuth) { ... }
}
app.bind('some', User);
app.make('some') // новый объект User
app.make('some') // новый объект User, совершенно другой, нежели раньше
app.bind('some', (app: Container) => new User('some', 'any'));
app.make('some') // вызываем замыкание, прокидываем контейнер (резолв из flowtype) и возвращаем результат
app.make('some') // Проделываем тоже самое ещё раз
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question