catiline
catiline copied to clipboard
MessageChannel
var p2;
var port = cw(function(data,cb){
this.x = new MessageChannel();
this.on('mess',function(a){
this.x.port1.postMessage(a);
});
cb(this.x.port2,[this.x.port2]);
});
port.data(1).then(function(a){
console.log('yes');
p2=a;
},function(a){
console.log(a);
});
p2.onmessage=function(a){
console.log('msg ',a.data);
}
port.fire('mess','hello there')
this could be a polyfill for sub workers in chrome