@stefanholzapfel/lit-helpers
v2.2.8
Published
A utility library for Lit
Downloads
29
Readme
lit-helpers
A utility library for Lit 2
npm install @stefanholzapfel/lit-helpers
This package includes some helper controllers and directives.
Programmatically add callbacks to execute when LitElement is detached from DOM.
@customElement('my-element')
export class MyElement extends LitElement{
// Create the controller and store it
private domDetachmentController = new DomDetachmentController(this);
anyElementFunction() {
this.domDetachmentController.addLogic(() => {
// do something, e.g. clean up dynamically created subscriptions
})
}
}