# lit-singleton

> A library to make singleton-like elements in lit

Latest version **0.1.9** (published 2023-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install lit-singleton
pnpm add lit-singleton
yarn add lit-singleton
bun add lit-singleton
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2023-02-13 |
| First published | 2023-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 46.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christian Duarte |
| Maintainers | christianduarte |

## Links

- npm: https://www.npmjs.com/package/lit-singleton
- Repository: https://github.com/ChristianDuarteL/lit-singleton
- Homepage: https://github.com/ChristianDuarteL/lit-singleton#readme
- Issues: https://github.com/ChristianDuarteL/lit-singleton/issues
- npm.io page: https://npm.io/package/lit-singleton

## Dependencies (1)

- [lit](https://npm.io/package/lit.md) ^2.0.2

## Recent versions

- 0.1.9 (latest) — 2023-02-13
- 0.1.8 — 2023-02-13
- 0.1.7 — 2023-02-12
- 0.1.6 — 2023-02-12
- 0.1.5 — 2023-02-12
- 0.1.4 — 2023-02-12
- 0.1.3 — 2023-02-12
- 0.1.2 — 2023-02-12
- 0.1.1 — 2023-02-12
- 0.1.0 — 2023-02-12

## README

# Lit Singleton

A library to make singleton-like elements in lit

## The issue

It's known that in a web page there are components that might only be required once at the time(e.g. alerts, snackbars)

And, by their nature, they need to be accesible in all parts of the code. 

This library, helps you make singleton-like web components, ina fairly easy way

## Installation

```bash
npm i lit-singleton
```

## Usage

```ts
import { Singleton } from 'lit-singleton';
@customElement('web-component')
class WebComponent extends Singleton{
    static generator?: (() => LitElement) = () => (document.createElement('web-component') as LitElement);
}
```

---
_Source: https://npm.io/package/lit-singleton · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
