Skip to content

Commit

Permalink
fix: target listener became unbound when referenced, avoid unbinding (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Dembrey authored Feb 18, 2020
1 parent 73a1c73 commit 6d829fc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/CornerstoneViewport/CornerstoneViewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,9 @@ class CornerstoneViewport extends Component {
const events = cornerstoneEvents.concat(cornerstoneToolsEvents);
const targetElementOrCornerstone =
targetType === 'element' ? this.element : cornerstone.events;
const targetListener = targetElementOrCornerstone[addOrRemoveEventListener];
const boundMethod = this._handleExternalEventListeners.bind(this);
for (let i = 0; i < events.length; i++) {
targetListener(events[i], boundMethod);
targetElementOrCornerstone[addOrRemoveEventListener](events[i], boundMethod);
}
}

Expand Down

0 comments on commit 6d829fc

Please sign in to comment.