watchvar
v1.0.0
Published
A simple utility, which allows you to detect if a variable has changed.
Downloads
3
Readme
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);