twixt-mutant

Proxy wrapper to trigger mutation events

Usage no npm install needed!

<script type="module">
  import twixtMutant from 'https://cdn.skypack.dev/twixt-mutant';
</script>

README

twixt-mutant Function

var Mutant = require("twixt-mutant"),
    obj = {};

Mutant(obj).addEventListener("mutate", function(evt) {
    var was, is;
    
    for (var prop in evt.mutations) {
        was = evt.mutations[prop];
        is = this[prop];
        console.log(prop, "changed from", was, "to", is);
    }
});