-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherase.js
More file actions
29 lines (28 loc) · 667 Bytes
/
Copy patherase.js
File metadata and controls
29 lines (28 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
Gun.on('opt', function(root){
this.to.next(root);
if(root.once){ return }
root.on('put', function(msg){
Gun.graph.is(msg.put, null, function(val, key, node, soul){
if(null !== val){ return }
// TODO: Refactor this to use `.off()`?
var tmp = root.graph[soul];
if(tmp){
delete tmp[key];
}
tmp = tmp && tmp._ && tmp._['>'];
if(tmp){
delete tmp[key];
}
tmp = root.next;
if(tmp && (tmp = tmp[soul]) && (tmp = tmp.put)){
delete tmp[key];
tmp = tmp._ && tmp._['>'];
if(tmp){
delete tmp[key];
}
}
});
this.to.next(msg);
});
});