watchvar

A simple utility, which allows you to detect if a variable has changed.

npm install watchvar
1 downloads in the last week
9 downloads in the last month

watcher

A simple utility, which allows you to detect if a variable has changed.

Installation

npm install watcher

Usage

var watcher = require("watcher");
var myVariable = 2;

var myVariableWatcher = watcher.watch(myVariable, function(newValue) {
    console.log("myVariable = %d", newValue);
    watcher.unwatch(myVariableWatcher);
});

// Change myVariable after 5 seconds
setTimeout(function() {
    myVariable = Math.random() * 99;
}, 5000);
npm loves you