feat(di): provide two ways to create an injector, resolved and unresolved
Add two factory static functions to Injector: resolveAndCreate and fromResolvedBindings. We want to avoid resolution and flattening every time we create a new injector. This commit allows the user to cache resolved bindings and reuse them.
This commit is contained in:
@ -110,8 +110,8 @@ function _getAppBindings() {
|
||||
}
|
||||
|
||||
export function createTestInjector(bindings: List) {
|
||||
var rootInjector = new Injector(_getRootBindings());
|
||||
return rootInjector.createChild(ListWrapper.concat(_getAppBindings(), bindings));
|
||||
var rootInjector = Injector.resolveAndCreate(_getRootBindings());
|
||||
return rootInjector.resolveAndCreateChild(ListWrapper.concat(_getAppBindings(), bindings));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user