SPFx webpart onBeforeDelete?
-
08-12-2020 - |
Pergunta
I need the ability to perform file cleanup when a client-side web part is deleted from the page. How can I listen for the delete event?
Solução
You should override the Dispose() method on BaseClientSideWebPart. Make sure you call the base implementation as well.
protected dispose(): void
{
// Do something interesting
Log.warn("HelloWorld", "Cleaning up my stuff", this.context.serviceScope);
// call the base class.
super.dispose();
}
Note however, there there is a currently a bug where this code doesn't necessarily get called. That will be fixed.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange