synchronous communication channel
npm install sync-channel
$ npm install sync-channel
`
Examples
read/write
` js
var SyncChannel = require('sync-channel');
var channel = new SyncChannel();
channel.read(function(value) {
console.log('value read', value);
});
channel.write(123, function() {
console.log('value written');
});
`
Aborting a read/write operation
` js
var SyncChannel = require('sync-channel');
var channel = new SyncChannel();
var abortRead = channel.read(function(value) {
console.log('value read', value);
});
setTimeout(function() {
abortRead();
console.log('you are so slow!');
}, 500);
setTimeout(function() {
channel.write(123, function() {
console.log('value written');
});
}, 1000);
``