Skip to content

Commit

Permalink
pull-request ace-diff#113 from orig: "Fix removing resize event handl…
Browse files Browse the repository at this point in the history
…er ..."
  • Loading branch information
empinator committed Mar 14, 2024
1 parent 8d51ff2 commit 77c039a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,10 @@ AceDiff.prototype = {
if (elementById) {
elementById.innerHTML = '';
}
removeEventHandlers();
this.removeEventHandlers();
},
};

let removeEventHandlers = () => { };

function addEventHandlers(acediff) {
acediff.editors.left.ace.getSession().on('changeScrollTop', throttle(() => { updateGap(acediff); }, 16));
acediff.editors.right.ace.getSession().on('changeScrollTop', throttle(() => { updateGap(acediff); }, 16));
Expand Down Expand Up @@ -305,7 +303,7 @@ function addEventHandlers(acediff) {
}, 250);

window.addEventListener('resize', onResize);
removeEventHandlers = () => {
acediff.removeEventHandlers = () => {
window.removeEventListener('resize', onResize);
};
}
Expand Down

0 comments on commit 77c039a

Please sign in to comment.