simple-watch

0.0.4 • Public • Published

simple watch

Fires events when objects change.

Installation

$ component install timoxley/simple-watch

Examples

Watch object properties

var user = {name: 'Tim', age: 27}
 
watch(user, 'name', function(current, previous) {
  console.log('Name was '+ previous +'. Name is now '+ current +'.')
})
 
user.name = 'Tim Oxley'
// => Name was Tim. Name is now Tim Oxley

Watch expressions

var user = {name: 'Tim', age: 27}
 
watch(user, 'age > 27', function() {
  console.log(user.name ' is now ' + user.age)
})
 
user.age++
 
// => Tim is now 28
 

License

MIT

/simple-watch/

    Package Sidebar

    Install

    npm i simple-watch

    Weekly Downloads

    1

    Version

    0.0.4

    License

    MIT

    Last publish

    Collaborators

    • timoxley