@stefanholzapfel/lit-helpers
TypeScript icon, indicating that this package has built-in type declarations

2.2.8 • Public • Published

lit-helpers

A utility library for Lit 2

Installation

npm install @stefanholzapfel/lit-helpers

This package includes some helper controllers and directives.

Reactive controllers

DomDetachmentController

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
        })
    }
}

Directives

Readme

Keywords

none

Package Sidebar

Install

npm i @stefanholzapfel/lit-helpers

Weekly Downloads

1

Version

2.2.8

License

MIT

Unpacked Size

4.74 kB

Total Files

17

Last publish

Collaborators

  • stefanholzapfel