refactor(ElementInjector): support components

- Allow to access containing component directive instance from the shadow DOM.
- Allow to access app services of the app level injector of the component
  when the component is instantiated.
This commit is contained in:
Tobias Bosch
2014-11-12 11:17:46 -08:00
parent c68e78075a
commit 7308a3acc7
8 changed files with 207 additions and 95 deletions

View File

@ -10,8 +10,8 @@ export function run () {
var bindings = [A, B, C];
var proto = new ProtoElementInjector(null, 0, bindings);
for (var i = 0; i < ITERATIONS; ++i) {
var ei = proto.instantiate(null,null);
ei.instantiateDirectives(appInjector);
var ei = proto.instantiate(null,null,null);
ei.instantiateDirectives(appInjector, null);
}
}

View File

@ -6,7 +6,7 @@ var count = 0;
export function run () {
var appInjector = new Injector([]);
var bindings = [
new Binding(Key.get(A), () => new A(), [], false),
new Binding(Key.get(B), () => new B(), [], false),
@ -18,8 +18,8 @@ export function run () {
var proto = new ProtoElementInjector(null, 0, bindings);
for (var i = 0; i < ITERATIONS; ++i) {
var ei = proto.instantiate(null,null);
ei.instantiateDirectives(appInjector);
var ei = proto.instantiate(null,null,null);
ei.instantiateDirectives(appInjector, null);
}
}

View File

@ -9,11 +9,11 @@ export function run () {
var bindings = [A, B, C];
var proto = new ProtoElementInjector(null, 0, bindings);
var ei = proto.instantiate(null,null);
var ei = proto.instantiate(null,null,null);
for (var i = 0; i < ITERATIONS; ++i) {
ei.clearDirectives();
ei.instantiateDirectives(appInjector);
ei.instantiateDirectives(appInjector, null);
}
}