1.0.0 • Published 6 years ago

obj-watcher-observe v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

obj-watcher

The watcher method watches for a property to be assigned a value and runs a function when that occurs.

example

const source = {
  name: 'zezhipeng'
}
const data = new Watcher(source)

data.watch('name', console.log)

data.name = 'cjh' // { oldVal: 'zezhipeng', newVal: 'cjh }

console.log(source) // { name: 'cjh' }