Skip to content

Commit

Permalink
Merge pull request #15029 from emberjs/cache-factory-for-injections
Browse files Browse the repository at this point in the history
[PERF] [BUGFIX Beta] cache factoryFor injections when possible
  • Loading branch information
stefanpenner authored Mar 16, 2017
2 parents 86dd9d2 + c807ac5 commit 5fba442
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/container/lib/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,18 @@ class FactoryManager {
this.fullName = fullName;
this.normalizedName = normalizedName;
this.madeToString = undefined;
this.injections = undefined;
}

create(options = {}) {
let injections = injectionsFor(this.container, this.normalizedName);

let injections = this.injections;
if (injections === undefined) {
injections = injectionsFor(this.container, this.normalizedName);
if (areInjectionsDynamic(injections) === false) {
this.injections = injections;
}
}
let props = assign({}, injections, options);

props[NAME_KEY] = this.madeToString || (this.madeToString = this.container.registry.makeToString(this.class, this.fullName));
Expand Down

0 comments on commit 5fba442

Please sign in to comment.