obj-watcher-observe

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i obj-watcher-observe

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.63 kB

Total Files

4

Last publish

Collaborators

  • zezhipeng