observed-remove
v2.3.1
Published
[](https://circleci.com/gh/wehriam/observed-remove) [](http://badge.fury.io/js/observed-remove) [ implemented using native Map and Set objects.
const { ObservedRemoveSet } = require('observed-remove');
const alice = new ObservedRemoveSet();
const bob = new ObservedRemoveSet();
alice.on('publish', (message) => {
setTimeout(() => bob.process(message), Math.round(Math.random() * 1000));
});
bob.on('publish', (message) => {
setTimeout(() => alice.process(message), Math.round(Math.random() * 1000));
});
alice.add('foo');
bob.add('bar');
// Later
alice.has('bar'); // true
bob.has('foo'); // trueconst { ObservedRemoveMap } = require('observed-remove');
const alice = new ObservedRemoveMap();
const bob = new ObservedRemoveMap();
alice.on('publish', (message) => {
setTimeout(() => bob.process(message), Math.round(Math.random() * 1000));
});
bob.on('publish', (message) => {
setTimeout(() => alice.process(message), Math.round(Math.random() * 1000));
});
alice.set('a', 1);
bob.add('b', 2);
// Later
alice.get('b'); // 2
bob.get('a'); // 1Install
yarn add observed-remove
