0.0.2 • Published 8 years ago

twixt-mutation-event v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

twixt-mutation-event Function

var EventTarget = require("twixt-event-target"),
    MutationEvent = require("twixt-mutation-event"),
    obj = EventTarget({foo: 42}),
    mutations = {},
    count = 0;

// example of proper
mutations.foo = obj.foo;    // mutations object holds original value
obj.foo = 13;   count++;    // increment mutation count
obj.foo = 23;   count++;    // increment mutation count
obj.foo = 23;               // count should not change if value does not change
mutations.bar = obj.bar;    // mutations object holds original value
obj.bar = 42;   count++;    // increment mutation count

obj.dispatchEvent(new MutationEvent(mutations, count));