launching!

This commit is contained in:
Mark Nadal 2017-01-27 05:23:49 -08:00
commit 4a2a845458
2 changed files with 11 additions and 5 deletions

12
gun.js
View File

@ -313,7 +313,6 @@
emit(last, act, event); emit(last, act, event);
} }
if(last !== act.on.last){ if(last !== act.on.last){
//console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>", last, act.on.last);
event(act); event(act);
} }
}); });
@ -1060,7 +1059,7 @@
if(cat.map){ // TODO: map will exist but different than if something in it. if(cat.map){ // TODO: map will exist but different than if something in it.
tmp = false; tmp = false;
obj_map(cat.map, function(coat){ obj_map(cat.map, function(coat){
console.log("CRASH3"); //console.log("CRASH3");
tmp = true; tmp = true;
coat.on('in', coat); coat.on('in', coat);
//cat.on('in').last.emit(coat); //cat.on('in').last.emit(coat);
@ -1559,6 +1558,10 @@
return; return;
} }
if(HAM.defer){ // TODO: BUG! Not implemented. if(HAM.defer){ // TODO: BUG! Not implemented.
union[field] = value; // WRONG! BUG! Need to implement correct algorithm.
state_ify(union, field, is); // WRONG! BUG! Need to implement correct algorithm.
// filler algorithm for now.
return;
/*upper.wait = true; /*upper.wait = true;
opt.upper.call(state, vertex, field, incoming, ctx.incoming.state); // signals that there are still future modifications. opt.upper.call(state, vertex, field, incoming, ctx.incoming.state); // signals that there are still future modifications.
Gun.schedule(ctx.incoming.state, function(){ Gun.schedule(ctx.incoming.state, function(){
@ -2371,7 +2374,7 @@
function request (peers, ctx) { function request (peers, ctx) {
if (Client.isSupported) { if (Client.isSupported) {
Client.broadcast(peers, { body: ctx }); Client.broadcast(peers, ctx);
} }
} }
@ -2380,12 +2383,13 @@
this.to.next(ctx); this.to.next(ctx);
var gun = ctx.gun; var gun = ctx.gun;
var peers = gun.back('opt.peers') || {}; var peers = gun.back('opt.peers') || {};
var headers = gun.back('opt.headers') || {};
// Validate. // Validate.
if (Gun.obj.empty(peers)) { if (Gun.obj.empty(peers)) {
return; return;
} }
request(peers, ctx); request(peers, {body: ctx, headers: headers});
}); });
request.jsonp = function (opt, cb) { request.jsonp = function (opt, cb) {

View File

@ -50,6 +50,7 @@ Gun.on('out', function (ctx) {
var gun = ctx.gun; var gun = ctx.gun;
var opt = ctx.opt || {}; var opt = ctx.opt || {};
var peers = opt.peers || gun.back('opt.peers'); var peers = opt.peers || gun.back('opt.peers');
var headers = opt.headers || gun.back('opt.headers') || {};
if (!peers) { if (!peers) {
return; return;
@ -57,8 +58,9 @@ Gun.on('out', function (ctx) {
var subset = getSocketSubset(peers); var subset = getSocketSubset(peers);
headers['gun-sid'] = sid;
subset.send({ subset.send({
headers: { 'gun-sid': sid }, headers: headers,
body: ctx, body: ctx,
}); });
}); });