Package Exports
- morphdom-hooks-mirror
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 (morphdom-hooks-mirror) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
morphdom-hooks
Lifecycle hooks for morphdom
example
const hooks = require('./')
const morphdom = hooks(require('morphdom'))
// create a button with some lifecycle handlers attached to it
function button () {
const b = document.createElement('button')
b.onadd = console.log.bind(console, 'button added to page!')
b.onupdate = console.log.bind(console, 'button updated in page!')
b.ondiscard = console.log.bind(console, 'button discarded from page!')
return b
}
const div0 = document.createElement('div')
document.body.appendChild(div0)
const div1 = document.createElement('div')
const button0 = button()
div1.appendChild(button0)
morphdom(div0, div1)
// logs 'button added to page!'
const div2 = document.createElement('div')
const button1 = button()
button1.style.color = 'red'
div2.appendChild(button1)
morphdom(div0, div2)
// logs 'button updated in page!'
const div3 = document.createElement('div')
morphdom(div0, div3)
// logs 'button discarded from page!'