npm.io
0.1.2 • Published 8 years ago

delta-watch

Licence
MIT
Version
0.1.2
Deps
0
Size
123 kB
Vulns
0
Weekly
0

Delta Watch

Object watching utility for JavaScript

Example

import DeltaWatch from "delta-watch";

// Create watchable object with inital values
let watchable = DeltaWatch.Watchable({
    value: "Initial"
});

DeltaWatch.Watch(watchable.Watcher.value, (value: string) => {
    console.log("new value", value);
});

watchable.Mutator.value = "Changed"; // cb gets call with "Changed"

// May also access current value
console.log(watchable.Accessor);
// logs "Changed"

Starting the example app

cd packages/examples
npm install

npm run build
npm start

Keywords