Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

Stars

0 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages