Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-augmentor

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-augmentor

DOM oriented useEffect hooks for the augmentor

  • 0.1.0
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dom-augmentor

This is exactly the same as the augmentor module, except it provides automatically connected and disconnected effects per dom nodes, when the guard is an empty Array.

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

import augmentor, {useEffect, useRef} from 'dom-augmentor';
import {render, hook} from 'lighterhtml';

const {html, svg} = hook(useRef);

const Button = text => augmentor(() => {
  useEffect(
    () => {
      console.log('connected');
      return () => {
        consle.log('disconnected');
      };
    },
    // empty array to have callbacks invoked
    // only when the node is connected live or disconnected
    []
  );
  html`<button>${text}</button>`;
});

const button = Button('hello');

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

Keywords

FAQs

Package last updated on 12 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc