Skip to content

Commit

Permalink
make sure handlers do not run when tooltip is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Dec 8, 2017
1 parent c76b515 commit 0b72622
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions addon/components/paper-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,18 @@ export default Component.extend({
let anchorElement = this.get('anchorElement');

let leaveHandler = () => {
this.set('hideTooltip', true);
run.later(() => {
if (!this.isDestroyed) {
this.set('renderTooltip', false);
}
}, 150);
if (!this.isDestroyed) {
this.set('hideTooltip', true);
run.later(() => {
if (!this.isDestroyed) {
this.set('renderTooltip', false);
}
}, 150);

anchorElement.addEventListener('blur', leaveHandler);
anchorElement.addEventListener('touchcancel', leaveHandler);
anchorElement.addEventListener('mouseleave', leaveHandler);
anchorElement.addEventListener('blur', leaveHandler);
anchorElement.addEventListener('touchcancel', leaveHandler);
anchorElement.addEventListener('mouseleave', leaveHandler);
}
};

let enterEventHandler = () => {
Expand Down

0 comments on commit 0b72622

Please sign in to comment.