We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f201a9 commit d0eb264Copy full SHA for d0eb264
src/wavesurfer.ts
@@ -388,11 +388,11 @@ class WaveSurfer extends Player<WaveSurferEvents> {
388
this.plugins.push(plugin)
389
390
// Unregister plugin on destroy
391
- this.subscriptions.push(
392
- plugin.once('destroy', () => {
393
- this.plugins = this.plugins.filter((p) => p !== plugin)
394
- }),
395
- )
+ const unsubscribe = plugin.once('destroy', () => {
+ this.plugins = this.plugins.filter((p) => p !== plugin)
+ this.subscriptions = this.subscriptions.filter((fn) => fn !== unsubscribe)
+ })
+ this.subscriptions.push(unsubscribe)
396
397
return plugin
398
}
0 commit comments