The solution is simply to duplicate the array before running the listeners. This is a common approach in event emitters implementation, and won't cause performance issues because the copy is shallow and most of the time there are only one or a few listeners for each event.
Fix for https://github.com/cornerstonejs/cornerstone/issues/444.
The solution is simply to duplicate the array before running the listeners. This is a common approach in event emitters implementation, and won't cause performance issues because the copy is shallow and most of the time there are only one or a few listeners for each event.