npm.io
1.0.0 • Published 8 years ago

observable-obj

Licence
ISC
Version
1.0.0
Deps
5
Vulns
0
Weekly
0
Stars
1

observable-obj

Highly performant observable objects for javascript without using Proxy objects.

Example


// Global listener will be called for every nested object
const observableObj = observable({a: "b", b: {c: "D"}}, true, function (prop, oldValue, newValue) {
    console.log({prop, oldValue, newValue});
});

// Local listener will be called only for that object
observableObj.listen(function (prop, oldValue, newValue) {
    console.log({prop, oldValue, newValue});
});


observableObj.a = "c";
console.log(observableObj);