Skip to content

Commit

Permalink
Merge c5ac3f0 into f8544de
Browse files Browse the repository at this point in the history
  • Loading branch information
osheroff committed Jun 23, 2020
2 parents f8544de + c5ac3f0 commit af6a3b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ wavesurfer.js changelog
4.0.0 (21.06.2020)
------------------

- Fixes for event handling with certain plugins (regions, microphone).
The crash would have involved '_disabledEventEmissions'
- Fixed mediaelement-webaudio playback under Safari (#1964)
- Fixed the `destroy` method of the `MediaElementWebAudio` backend. Instead of
destroying only the media element, the audio nodes are disconnected and the
Expand Down
11 changes: 10 additions & 1 deletion src/util/observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,23 @@ export default class Observer {
this._disabledEventEmissions = eventNames;
}

/**
* plugins borrow part of this class without calling the constructor,
* so we have to be careful about _disabledEventEmissions
*/

_isDisabledEventEmission(event) {
return this._disabledEventEmissions && this._disabledEventEmissions.includes(event);
}

/**
* Manually fire an event
*
* @param {string} event The event to fire manually
* @param {...any} args The arguments with which to call the listeners
*/
fireEvent(event, ...args) {
if (!this.handlers || this._disabledEventEmissions.includes(event)) {
if (!this.handlers || this._isDisabledEventEmission(event)) {
return;
}

Expand Down

0 comments on commit af6a3b0

Please sign in to comment.