Skip to content

Commit

Permalink
dont create multiple versions of bound function
Browse files Browse the repository at this point in the history
  • Loading branch information
Josiah Campbell committed Sep 29, 2020
1 parent cce8600 commit 3edbb23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions addon/components/draggable-object-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,24 @@ export default Component.extend(Droppable, {

didInsertElement() {
this._super(...arguments);
this.element.addEventListener('mouseenter', this.handleMouseEnter.bind(this));
this.element.addEventListener('mouseenter', this.boundHandleMouseEnter);
},

willDestroyElement() {
this._super(...arguments);
this.element.removeEventListener('mouseenter', this.handleMouseEnter.bind(this));
this.element.removeEventListener('mouseenter', this.boundHandleMouseEnter);
},

actions: {
acceptForDrop() {
let hashId = this.get('coordinator.clickedId');
this.handlePayload(hashId);
}
},

init() {
this._super(...arguments);

this.set('boundHandleMouseEnter', this.handleMouseEnter.bind(this));
}
});

0 comments on commit 3edbb23

Please sign in to comment.