Socket
Book a DemoInstallSign in
Socket

simple-watch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-watch

Trigger callbacks when objects, properties or expressions change.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 10 Jun 2013

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