0.0.1 • Published 9 years ago
@wmakeev/locator v0.0.1
locator
##locator.publish(key, value)
// Publish some value
let publish = locator.publish('foo', 'bar')
// .. and later you can stop 'foo' publishing
publish.stop()
##locator.discover(key, handler)
let discover = locator.discover('foo', (value, stop) => {
if (value === 'bar') {
stop(); // stop discover for 'foo'
// some stuff with value ...
}
})
setTimeout(() => {
discover.stop(); // stop discover for 'foo'
throw new Error('foo discover timeout');
}, 15000);
0.0.1
9 years ago