Skip to content
Faster and simplified version of on-load without dom diffing support
Branch: master
Clone or download
Latest commit 10c8634 May 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore first commit May 15, 2019
.travis.yml Streamline repo May 15, 2019
LICENSE first commit May 15, 2019
README.md Streamline repo May 15, 2019
example.js Streamline repo May 15, 2019
index.js first commit May 15, 2019
package.json 1.0.0 May 15, 2019
test.js first commit May 15, 2019

README.md

fast-on-load

Build Status

Faster and simplified version of on-load without dom diffing support.

Usage

const onload = require('fast-on-load')

onload(domElement, function () {
  console.log('element was mounted')
}, function () {
  console.log('element was unmounted')
})

Uses a MutationObserver and a generated class together with getElementsByClassName() to find DOM nodes that on-load is tracking, which performs much faster (around 1000x in our machines) on bigger DOM trees that the tree traversal algo on-load uses.

API

const node = onload(node, [onload], [onunload])

Watch node, optionally passing onload and onunload handler. Returns the node itself.

Install

npm install fast-on-load

License

MIT

You can’t perform that action at this time.