Skip to content

Commit

Permalink
Merge pull request #14756 from rwjblue/disable-event-manager-by-default
Browse files Browse the repository at this point in the history
Disable costly eventManager support when unused.
  • Loading branch information
rwjblue authored Dec 25, 2016
2 parents 34ea52b + 0f68cb5 commit 9b11b21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion packages/ember-views/lib/mixins/view_support.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { guidFor } from 'ember-utils';
import { guidFor, getOwner } from 'ember-utils';
import { assert, deprecate, descriptor, Mixin } from 'ember-metal';
import { environment } from 'ember-environment';
import { matches } from '../system/utils';
Expand Down Expand Up @@ -441,6 +441,18 @@ export default Mixin.create({
this.elementId = guidFor(this);
}

// if we find an `eventManager` property, deopt the
// `EventDispatcher`'s `canDispatchToEventManager` property
// if `null`
if (this.eventManager) {
let owner = getOwner(this);
let dispatcher = owner && owner.lookup('event_dispatcher:main');

if (dispatcher && dispatcher.canDispatchToEventManager === null) {
dispatcher.canDispatchToEventManager = true;
}
}

deprecate(
`[DEPRECATED] didInitAttrs called in ${this.toString()}.`,
typeof(this.didInitAttrs) !== 'function',
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-views/lib/system/event_dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ export default EmberObject.extend({
@property canDispatchToEventManager
@type boolean
@default 'true'
@default false
@since 1.7.0
@private
*/
canDispatchToEventManager: true,
canDispatchToEventManager: null,

init() {
this._super();
Expand Down

0 comments on commit 9b11b21

Please sign in to comment.