Skip to content

Commit

Permalink
Merge pull request #13797 from rwjblue/prevent-slowdown-inprod
Browse files Browse the repository at this point in the history
[BUGFIX beta] Ensure didInitAttrs deprecation is stripped in prod.
  • Loading branch information
krisselden authored Jul 7, 2016
2 parents f8d7dbc + 67a9111 commit 2fefde6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions packages/ember-metal/lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ export function accumulateListeners(obj, eventName, otherActions) {
export function addListener(obj, eventName, target, method, once) {
assert('You must pass at least an object and event name to Ember.addListener', !!obj && !!eventName);

if (eventName === 'didInitAttrs' && obj.isComponent) {
deprecate(
`[DEPRECATED] didInitAttrs called in ${obj.toString()}.`,
false,
{
id: 'ember-views.did-init-attrs',
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs'
}
);
}
deprecate(
`didInitAttrs called in ${obj && obj.toString && obj.toString()}.`,
eventName !== 'didInitAttrs',
{
id: 'ember-views.did-init-attrs',
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs'
}
);

if (!method && 'function' === typeof target) {
method = target;
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/tests/events_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,5 @@ QUnit.test('DEPRECATED: adding didInitAttrs as a listener is deprecated', functi

expectDeprecation(() => {
addListener(obj, 'didInitAttrs');
}, /\[DEPRECATED\] didInitAttrs called in <\Ember.Component\:ember[\d+]+>\./);
}, /didInitAttrs called in <\Ember.Component\:ember[\d+]+>\./);
});

0 comments on commit 2fefde6

Please sign in to comment.