Skip to content

Commit

Permalink
Don't fail on destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Aug 16, 2024
1 parent 95c9ad3 commit 8ba4035
Show file tree
Hide file tree
Showing 6 changed files with 743 additions and 147 deletions.
20 changes: 13 additions & 7 deletions dist/musicxml-player.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* musicxml-player v0.18.1
* musicxml-player v0.18.2
* (c) Karim Ratib <[email protected]> (https://github.com/infojunkie)
* Released under the GPL-3.0-only License.
*/
Expand Down Expand Up @@ -12588,7 +12588,7 @@ const timingObjectConstructor = createTimingObjectConstructor(createCalculateTim
// @todo Expose an isSupported flag which checks for performance.now() support.

var name = "musicxml-player";
var version = "0.18.1";
var version = "0.18.2";
var description = "A simple JavaScript component that loads and plays MusicXML files in the browser using Web Audio and Web MIDI.";
var main = "dist/musicxml-player.esm.js";
var type = "module";
Expand Down Expand Up @@ -12816,11 +12816,17 @@ class Player {
* Destroy the instance by freeing all resources and disconnecting observers.
*/
destroy() {
this._timingObject.removeEventListener('change', this._timingObjectListener);
this._sheet.remove();
this._observer.disconnect();
this._midiPlayer.stop();
this._options.renderer.destroy();
// Never fail during destruction.
try {
this._timingObject.removeEventListener('change', this._timingObjectListener);
this._sheet.remove();
this._observer.disconnect();
this._midiPlayer.stop();
this._options.renderer.destroy();
}
catch (error) {
console.error(`[Player.destroy] ${error}`);
}
}
/**
* Advance the playback and visual cursor to a given location.
Expand Down
2 changes: 1 addition & 1 deletion dist/musicxml-player.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/types/Player.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8ba4035

Please sign in to comment.