Closed
Description
Just ran into a case where it would be useful to know, within a component method, whether or not the component still exists (the method runs in a setTimeout
, which could fire after the component has been destroyed).
With knowledge of the internals there are various ways to do this, and you could also do it by setting a custom property inside a destroy
event handler, but it might be nice if there was a standard, documented way to do it:
export default {
methods: {
thingThatRunsPeriodically() {
if (this.destroyed) return;
doSomeStuff();
}
}
};
Metadata
Metadata
Assignees
Labels
No labels