It's often useful to be able to run a callback whenever a certain value changes. For example, maybe whenever the user's timezone changes, different parts of the app want to react in different ways to update clocks and other things.
For example:
const kvjs = require('@heyputer/kv.js');
// Create a new kv.js instance
const kv = new kvjs();
// Watch the key for changes
kv.watch('foo', value => {
console.log('foo changed!', value);
});
// Set a key
kv.set('foo', 42);
// Console will log 'foo changed! 42'