wormboy / conduitjs

Published:

Version: 1.0.0+2d5d1a9

Summary: Send DOM changes through a pipeline.

Copyright: 2019, badbrainz (https://github.com/badbrainz)

License: MIT; https://github.com/badbrainz/conduit.js/raw/master/LICENSE

conduit.js connects mutation observers together to form a pipeline for complex mutation processing.

example

// Use built-in observers.
conduit.observe(document.body)
  .filter('a')
  .attribute('href')
  .each(a => console.log(a.getAttribute('href'))
// Create observer routes.
const links = conduit.observe(document.body).filter('a')
links.attribute('class').each(a => console.log(a.className))
links.text('lorem ipsum').each(t => console.log(t.data))
// Combine a series custom observers.
let one = conduit.junction(stepOne)
let two = conduit.junction(stepTwo)
let three = conduit.junction(stepThree)
conduit(one, two, three)

For documentation, see https://github.com/badbrainz/conduit.js

Userscripts Using This Library

Rating: 0