JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgithub.com/melanke/Watch.JS/master/src/watch.js"></script>
JavaScript
//defining our object no matter which way we want
var ex = {
//level 0
l1a: "bla bla",
l1b: {
//level 1 or less
l2a: "lo lo",
l2b: {
//level 2 or less
deeper: "so deep"
}
}
};
watch(ex, function(){
alert("ex changes at lvl 2 or less");
}, 1);
watch(ex, function(){
alert("ex changes at lvl 3 or less");
}, 2);
ex.l1b.l2b.deeper = "other value";
ex.l1b.l2b = "other value";