0.0.4 • Published 11 years ago

simple-watch v0.0.4

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

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

0.0.4

11 years ago

0.0.3

11 years ago

0.0.1

11 years ago