@sonicgarden/onconnect
v0.2.0
Published
Run something when a DOM element appears and when it exits.
Downloads
1,026
Keywords
Readme
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.