NgAudioObject destroy does not destroy object.
Closed this issue · 3 comments
Hello,
I noticed that on a NgAudioObject
is possible to call the destroy()
method.
This method as far as I can see delete the timeouts and the watchers on the object.
function $destroy() {
if (!$destroyed) {
if (interval) {
$interval.cancel(interval);
}
if ($intervalWatch) {
$intervalWatch();
}
if ($audioWatch) {
$audioWatch();
}
$destroyed = true;
}
}
This LGTM since I can use this method to destroy an audio every time I want from a controller which import the ngAudio service, but then, I don't have a way to check if a NgAudioObject
has been destroyed or not.
I see that once an NgAudioObject
is destroyed, the internal variable $destroyed
is set to true.
What if you expose also this variable on the NgAudioObject
?
Something like this maybe?
this.destroyed = function() {
return $destroyed;
};
Simone
I'd be happy to have a look at a pull request - if so, update docs as well accordingly.
@danielstern I reopened the issue with a PR.
Please check it and tell me if looks ok to you.
Simone
Merged!