Skip to content

Commit

Permalink
Merge pull request #2 from stefanpenner/eds
Browse files Browse the repository at this point in the history
speed up Meta instantiation
  • Loading branch information
ef4 committed Aug 5, 2015
2 parents 714f0b8 + b6b0739 commit 584fc73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function sendEvent(obj, eventName, params, actions) {
actions = meta && meta.matchingListeners(eventName);
}

if (!actions) { return; }
if (!actions || actions.length === 0) { return; }

for (var i = actions.length - 3; i >= 0; i -= 3) { // looping in reverse for once listeners
var target = actions[i];
Expand Down
12 changes: 8 additions & 4 deletions packages/ember-metal/lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ let members = {
};

let memberNames = Object.keys(members);
let memberProperties = memberNames.map(memberProperty);

function Meta(obj, parentMeta) {
// preallocate a slot for each member
memberProperties.forEach(prop => this[prop] = undefined);

this.cache = undefined;
this.watching = undefined;
this.mixins = undefined;
this.bindings = undefined;
this.values = undefined;
this.deps = undefined;
this.chainWatchers = undefined;
this.chains = undefined;
// used only internally
this.source = obj;

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-views/lib/views/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, {

_template: computed('templateName', {
get() {
if (get(this, '_deprecatedFlagForBlockProvided')) {
if (this._deprecatedFlagForBlockProvided) {
return true;
}
var templateName = get(this, 'templateName');
Expand Down

0 comments on commit 584fc73

Please sign in to comment.