# dom-augmentor

> DOM oriented useEffect hooks for the augmentor

Latest version **2.0.8** (published 2020-04-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install dom-augmentor
pnpm add dom-augmentor
yarn add dom-augmentor
bun add dom-augmentor
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.8 |
| Published | 2020-04-11 |
| First published | 2019-01-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrea Giammarchi |
| Maintainers | webreflection |
| Keywords | hooks, dom, observer, augmentor |

## Links

- npm: https://www.npmjs.com/package/dom-augmentor
- npm.io page: https://npm.io/package/dom-augmentor

## Dependencies (4)

- [augmentor](https://npm.io/package/augmentor.md) ^2.2.0
- [disconnected](https://npm.io/package/disconnected.md) ^0.2.1
- [@ungap/weakset](https://npm.io/package/@ungap/weakset.md) ^0.1.5
- [@ungap/custom-event](https://npm.io/package/@ungap/custom-event.md) ^0.2.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.8 (latest) — 2020-04-11
- 2.0.7 — 2020-03-16
- 2.0.6 — 2020-03-15
- 2.0.5 — 2020-01-08
- 2.0.4 — 2019-12-12
- 2.0.3 — 2019-12-08
- 2.0.2 — 2019-12-08
- 2.0.1 — 2019-12-01
- 2.0.0 — 2019-11-29
- 1.4.0 — 2019-11-21
- 1.3.1 — 2019-11-20
- 1.3.0 — 2019-11-19
- 1.2.1 — 2019-11-15
- 1.2.0 — 2019-11-15
- 1.1.5 — 2019-11-15
- … 26 more at https://npm.io/package/dom-augmentor/versions

## README

# dom-augmentor

[![Build Status](https://travis-ci.com/WebReflection/dom-augmentor.svg?branch=master)](https://travis-ci.com/WebReflection/dom-augmentor) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/dom-augmentor/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/dom-augmentor?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/WebReflection/dom-augmentor.svg)](https://greenkeeper.io/) ![WebReflection status](https://offline.report/status/webreflection.svg)

<sup>**Social Media Photo by [stephan sorkin](https://unsplash.com/@sorkin) on [Unsplash](https://unsplash.com/)**</sup>

This is exactly the same as the [augmentor](https://github.com/WebReflection/augmentor) module, except it handles automatically effects per DOM nodes.

Compatible with any function that returns a DOM node, or a fragment, or a hyperhtml like Wire instance.



### Breaking in v1

  * the default export has been removed, it's `import {augmentor} from 'augmentor'` now
  * the `augmentor` library is the v1 one
  * effects now work more reliably and there are no constrains for the guards



### Example

**[Live Demo](https://codepen.io/WebReflection/pen/maQXwq)**

```js
const {augmentor: $, useEffect, useRef, useState} = augmentor;
const {render, hook} = lighterhtml;
const {html, svg} = hook(useRef);

const Button = (text) => $(() => {
  useEffect(
    () => {
      console.log('connected');
      return () => console.log('disconnected');
    },
    []
  );
  const [i, increment] = useState(0);
  return html`
  <button onclick=${() => increment(i + 1)}>
    ${text} ${i}
  </button>`;
});

const button = Button('hello');

render(document.body, button);
// alternatively
// document.body.appendChild(button());
```

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