fix SEA graph

This commit is contained in:
Mark Nadal 2017-12-16 13:38:37 -08:00
parent a4d03f6d73
commit 41f53dff8d
6 changed files with 21 additions and 21 deletions

3
gun.js
View File

@ -758,9 +758,10 @@
function map(msg, soul){ var tmp; function map(msg, soul){ var tmp;
if(!msg.gun){ return } if(!msg.gun){ return }
if((tmp = this.gun._).tag.node){ if((tmp = this.gun._).tag.node){
return tmp.on('node', function(msg){ this.off(); tmp.on('node', function(msg){ this.off();
(msg.gun._).on('in', msg); (msg.gun._).on('in', msg);
}).on.on('node', msg); }).on.on('node', msg);
return;
} }
(msg.gun._).on('in', msg); (msg.gun._).on('in', msg);
} }

2
gun.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "gun", "name": "gun",
"version": "0.9.3", "version": "0.9.4",
"description": "Graph engine", "description": "Graph engine",
"main": "index.js", "main": "index.js",
"browser": "gun.min.js", "browser": "gun.min.js",

5
sea.js
View File

@ -849,7 +849,10 @@
check['user'+soul+key] = 1; check['user'+soul+key] = 1;
if(user && (user = user._) && user.sea){ if(user && (user = user._) && user.sea){
if(pub === user.pub){ if(pub === user.pub){
SEA.write(val, Gun.obj.to(user.sea, {pub: user.pub, epub: user.epub}), function(data){ SEA.write(val, Gun.obj.to(user.sea, {pub: user.pub, epub: user.epub}), function(data){ var rel;
if(rel = Gun.val.rel.is(val)){
(at.sea.own[rel] = at.sea.own[rel] || {})[pub] = true;
}
node[key] = data; node[key] = data;
check['user'+soul+key] = 0; check['user'+soul+key] = 0;
each.end({ok: 1}); each.end({ok: 1});

View File

@ -117,9 +117,10 @@ Gun._ = { // some reserved key words, these are not the only ones.
function map(msg, soul){ var tmp; function map(msg, soul){ var tmp;
if(!msg.gun){ return } if(!msg.gun){ return }
if((tmp = this.gun._).tag.node){ if((tmp = this.gun._).tag.node){
return tmp.on('node', function(msg){ this.off(); tmp.on('node', function(msg){ this.off();
(msg.gun._).on('in', msg); (msg.gun._).on('in', msg);
}).on.on('node', msg); }).on.on('node', msg);
return;
} }
(msg.gun._).on('in', msg); (msg.gun._).on('in', msg);
} }

View File

@ -3,34 +3,29 @@
<script src="../sea.js"></script> <script src="../sea.js"></script>
<script> <script>
;(function(){ ;(function(){
//localStorage.clear(); localStorage.clear();
var gun = window.gun = Gun(); var gun = window.gun = Gun();
var user = gun.user(); var user = gun.user();
//user.create('alice', 'asdf', login); user.create('alice', 'asdf', login);
//login();
get();
function login(ack){ function login(ack){
user.auth('alice', 'asdf', read); console.log("login...");
} user.auth('alice', 'asdf', write);
function read(ack){
console.log(ack);
user.get('foo').put('yay!').val(write);
} }
function write(data){ function write(data){
var test = {I: "go infinitely"}; console.log("write...");
test.bar = {yes: "please!", parent: test}; var alice = {name: "Alice"};
user.get('test').put(test); alice.boss = {name: "Fluffy", slave: alice};
user.get('profile').put(alice, get);
} }
function get(){ function get(){
//user.get('obj').get('some').val(function(data){ console.log("get...");
gun.get('alias/alice').map().get('test').get('bar').get('parent').get('I').val(function(data){ user.get('profile').get('boss').get('slave').get('name').val(function(data){
console.log("!!!", data); console.log("The boss's slave's name is:", data);
}) })
} }