How to use the di/di.Key.get function in di

To help you get started, we’ve selected a few di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular / modules / benchmarks / src / element_injector / instantiate_benchmark_codegen.js View on Github external
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),
    new Binding(Key.get(C), (a,b) => new C(a,b), [
      new Dependency(Key.get(A), false, false, []),
      new Dependency(Key.get(B), false, false, [])
    ], false)];


  var proto = new ProtoElementInjector(null, 0, bindings);
  for (var i = 0; i < ITERATIONS; ++i) {
    var ei = proto.instantiate(null,null);
    ei.instantiateDirectives(appInjector, null, null);
  }
}
github angular / angular / modules / benchmarks / src / element_injector / instantiate_benchmark_codegen.js View on Github external
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),
    new Binding(Key.get(C), (a,b) => new C(a,b), [
      new Dependency(Key.get(A), false, false, []),
      new Dependency(Key.get(B), false, false, [])
    ], false)];


  var proto = new ProtoElementInjector(null, 0, bindings);
  for (var i = 0; i < ITERATIONS; ++i) {
    var ei = proto.instantiate(null,null);
    ei.instantiateDirectives(appInjector, null, null);
  }
}
github angular / angular / modules / core / src / compiler / static_keys.js View on Github external
constructor() {
    //TODO: vsavkin Key.annotate(Key.get(View), 'static')
    this.viewId = Key.get(View).id;
    this.ngElementId = Key.get(NgElement).id;
  }
github angular / angular / modules / core / src / compiler / static_keys.js View on Github external
constructor() {
    //TODO: vsavkin Key.annotate(Key.get(View), 'static')
    this.viewId = Key.get(View).id;
    this.ngElementId = Key.get(NgElement).id;
  }
github angular / angular / modules / benchmarks / src / element_injector / instantiate_benchmark_codegen.js View on Github external
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),
    new Binding(Key.get(C), (a,b) => new C(a,b), [
      new Dependency(Key.get(A), false, false, []),
      new Dependency(Key.get(B), false, false, [])
    ], false)];


  var proto = new ProtoElementInjector(null, 0, bindings);
  for (var i = 0; i < ITERATIONS; ++i) {
    var ei = proto.instantiate(null,null);
    ei.instantiateDirectives(appInjector, null, null);
  }
}