mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
21 lines
462 B
JavaScript
21 lines
462 B
JavaScript
;(function(){
|
|
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
|
|
|
|
Gun.on('opt', function(root){
|
|
once(root);
|
|
this.to.next(root);
|
|
});
|
|
|
|
function once(root){
|
|
if(root.once){ return }
|
|
var forget = root.opt.forget = root.opt.forget || {};
|
|
root.on('put', function(msg){
|
|
Gun.graph.is(msg.put, function(node, soul){
|
|
if(!Gun.obj.has(forget, soul)){ return }
|
|
delete msg.put[soul];
|
|
});
|
|
this.to.next(msg);
|
|
});
|
|
}
|
|
|
|
}()); |