katspaugh/wavesurfer.js — pull request #133 by mwise (2014-03-08 16:49:40+00:00)
Title: Mouseup event

This PR adds event bubbling for the 'mouseup' event so that external objects (including plugins) can listen for the 'mouseup' event that is triggered by wavesurfer. NOTE: This PR includes https://github.com/katspaugh/wavesurfer.js/pull/132 and should only be merged if that PR is going to be merged.

@katspaugh - I noticed that when you refactored the drag events, you used document.addEventListener when registering the mouseup callback. What was your motivation for this? In order to properly bubble up a wavesurfer-only mouseup event, I had to add an additional listener for mouseup on the wavesurfer wrapper itself. I imagine there was some consideration that went into the decision to listen for that even on the document, but I couldn't deduce it from the code. Hence the additional listener, which shouldn't have any performance or other impact.

The main benefit of having this event (for our purposes, at least) is to listen for when a user has finished selecting a new region of the waveform.

Cheers,

Mark