# lit-document-event

> Easily handle global document events for LitElement

Latest version **0.0.1** (published 2021-02-16) · LGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install lit-document-event
pnpm add lit-document-event
yarn add lit-document-event
bun add lit-document-event
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-02-16 |
| First published | 2021-02-16 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 149.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | gitaarik |
| Maintainers | gitaarik |
| Keywords | LitElement, lit-element, document, event, global, html |

## Links

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

## Dependencies (1)

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

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2021-02-16

## README

# LitDocumentEvent

### Simple global event handling

Easily add listeners to the `document` object, and have them removed when the
component disconnects.


## Installation

```
npm install lit-document-event
```


## Usage

```javascript
<document-event eventname="keydown" @event=${this.handleKeyDown}></document-event>
```

It doesn't matter where in your template you put this component. It doesn't
have a UI, it just adds a listener for the desired event and emits an event on
the component, so you can easily bind to it with lit-html (with the
`@event=${this.myEventHandler}` syntax). When the component is disconnected,
the listener will be removed.


## Demo app

To see it working, check out the
[demo app](https://gitaarik.github.io/lit-document-event/docs/build/).


## Also see

- [LitStyle](https://github.com/gitaarik/lit-style) - Shared component styles for LitElement 
- [LitState](https://github.com/gitaarik/lit-state) - Simple shared app state management for LitElement

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