0.2.0 • Published 7 months ago

@sonicgarden/onconnect v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

onconnect

Run something when a DOM element appears and when it exits.

Installation

npm install @sonicgarden/onconnect
yarn add @sonicgarden/onconnect
pnpm install @sonicgarden/onconnect

Usage

import { onConnect } from '@sonicgarden/onconnect'

onConnect('[data-popover]', (el) => {
  const popover = new Popover(el)

  // optional
  return () => {
    popover.destroy()
  }
})

Inspired by onmount.

0.2.0

7 months ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago