mutation-iterator
v0.2.0
Published
Creates an object which is an async iterator which yields when any of its properties are mutated
Downloads
7
Readme
mutation-iterator
Creates an object which is an async iterator which yields when any of its properties are mutated
Install
npm i mutation-iterator
Usage
import mutationIterator, { finish } from 'mutation-iterator';
const obj = mutationIterator();
obj.someProp = 'Initial...';
setTimeout(() => {
obj.someProp = 'Hello';
finish(obj);
}, 1000);
console.log(obj.someProp);
for await (const { someProp } of obj) {
console.log(someProp);
}
console.log('Finished');