katspaugh/wavesurfer.js — pull request #229 by rgagnon24 (2014-08-25 17:31:21+00:00)
Title: Fix events being fired multiple times

Resolves issue #214

region-over, region-leave, region-click, mark-over, mark-leave, and mark-click previously would fire once for each mark or region created, instead of just once for the particular mark or region that was related to the event.

The cause was the "on event" being defined within the Mark or Region, thus creating an entry into the "handlers" array for that event each time a new Mark or Region was created. Moving the "on event" capture into createDrawer() ensures the event handler is created only once.