mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
commit
106e926cd6
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,4 +2,6 @@ node_modules/*
|
||||
npm-debug.log
|
||||
*data.json
|
||||
*.db
|
||||
.idea/
|
||||
.idea/
|
||||
*.bak
|
||||
*.new
|
@ -8,7 +8,7 @@
|
||||
}
|
||||
, "dependencies": {
|
||||
"express": "~>4.9.0",
|
||||
"gun": "~>0.2.0-alpha-3"
|
||||
"gun": "~>0.2.0-alpha-4"
|
||||
}
|
||||
, "scripts": {
|
||||
"start": "node http.js",
|
||||
|
13
gun.js
13
gun.js
@ -553,8 +553,17 @@
|
||||
}
|
||||
} else {
|
||||
(ctx[$.soul] = function(delta, $$){
|
||||
$$ = $$ || $; var node = gun.__.graph[$$.soul];
|
||||
if(delta && $.soul != Gun.is.soul.on(delta)){ return }
|
||||
$$ = $$ || $; var node = gun.__.graph[$$.soul], soul;
|
||||
if(delta && $$.soul != Gun.is.soul.on(delta)){ return }
|
||||
if($$.field && (soul = Gun.is.soul(node[$$.field]))){
|
||||
(ctx[$$.soul + $$.field] || {off:function(){}}).off();
|
||||
ctx[$$.soul + $$.field] = gun.__.on(soul).event(function(delta){
|
||||
ctx[$.soul](delta, {soul: soul, field: null, at: $.field});
|
||||
});
|
||||
// TODO: do we need to load it? what about that $.gun context?
|
||||
return;
|
||||
}
|
||||
|
||||
if(opt.raw){ return cb.call($$.gun || gun, $$, delta, this) }
|
||||
if(!opt.end && Gun.obj.empty(delta, Gun._.meta)){ return }
|
||||
if($$.key){ node = Gun.union.pseudo($.key, gun.__.key.s[$.key]) || node }
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.2.0-alpha-3",
|
||||
"version": "0.2.0-alpha-4",
|
||||
"description": "Graph engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -1858,6 +1858,29 @@ describe('Gun', function(){
|
||||
},100);
|
||||
},200);
|
||||
});
|
||||
|
||||
it("gun put null path on put sub object", function(done){ // consensus4's bug
|
||||
done.c = 1;
|
||||
var gun = Gun();
|
||||
//Gun.log.verbose = true;
|
||||
var game = gun.put({board: null, teamA: null, teamB: null, turn: null}).key('the/game');
|
||||
game.path('board').on(function(board, field){
|
||||
expect(field).to.be('board');
|
||||
if(done.c == 1){
|
||||
expect(board).to.not.be.ok();
|
||||
}
|
||||
if(done.c === 2){
|
||||
done.c++;
|
||||
delete board._;
|
||||
expect(board).to.be.eql({11: ' ', 22: ' ', 33: 'A'});
|
||||
done();
|
||||
}
|
||||
});
|
||||
setTimeout(function(){
|
||||
done.c++;
|
||||
game.put({board: {11: ' ', 22: ' ', 33: 'A'}});
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Streams', function(){
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user