JSPM

pull-dom-mutants

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 4
    • Score
      100M100P100Q9979F
    • License ISC

    Package Exports

    • pull-dom-mutants

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-dom-mutants) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    pull-dom-mutants

    pull-stream source of mutations to a dom element using Mutation Observer. Emits Mutation Records

    Example

    var pullMutants = require('pull-dom-mutants')
    var pull = require('pull-stream')
    var test = require('tape')
    
    test('emitter emits a value when child element appended', function (t) {
      var elem = document.createElement('main')
      var child = document.createElement('h1')
      pull(
        pullMutants(elem, {childList: true}),
        pull.take(1),
        pull.drain(function (mutation) {
          var addedChild = mutation.target.querySelector('h1')
          t.equal(addedChild, child)
          t.end()
          window.close()
        })
      )
    
      t.false(elem.querySelector('h1'))
      elem.appendChild(child)
    })
    

    API

      pullMutants(elem [, opts])

    Where opts are the options to pass along to Mutation Observer, defaults to {childList: true}