New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

morphdom-hooks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morphdom-hooks

Lifecycle hooks for morphdom

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
41
412.5%
Maintainers
1
Weekly downloads
 
Created
Source

morphdom-hooks

Build Status

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!'

Keywords

hook

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts