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;
if(!msg.gun){ return }
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);
}).on.on('node', msg);
return;
}
(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",
"version": "0.9.3",
"version": "0.9.4",
"description": "Graph engine",
"main": "index.js",
"browser": "gun.min.js",

5
sea.js
View File

@ -849,7 +849,10 @@
check['user'+soul+key] = 1;
if(user && (user = user._) && user.sea){
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;
check['user'+soul+key] = 0;
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;
if(!msg.gun){ return }
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);
}).on.on('node', msg);
return;
}
(msg.gun._).on('in', msg);
}

View File

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