untitled.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. function input(msg){
  2. var ev = this, cat = this.as, gun = msg.gun, at = gun._, change = msg.put, rel, tmp;
  3. // dispatch to chain listeners.
  4. // dispatch to children.
  5. // dispatch to echoes.
  6. if(u === change){
  7. // Here are the possible options:
  8. // 1. We think the data does not exist because peers/disk cannot find it.
  9. // 2. We know the data does not exist because a parent is or was changed to a primitive.
  10. // Souls can only (1) because they have no parent.
  11. // Has can be (1) or (2).
  12. // Gets and chains can be (1) or (2).
  13. if(cat.soul || cat.has){
  14. // a soul can never become undefined.
  15. // a soul can only not be found.
  16. if(cat.soul && u !== cat.put){
  17. return;
  18. }
  19. // a key may sometimes might not be found.
  20. // a key on a soul can not become undefined,
  21. // but the chain might be on a chain that
  22. // does not exist, and therefore can be undefined.
  23. ev.to.next(msg); // ex, notify val and stuff.
  24. echo(cat, msg, ev); // ex, notify a sub-object pointer like `mark.pet`! // TODO: BUG ON VAL, it will still not get called because it checks !node when it should also check ack.
  25. if(cat.soul){ return }
  26. obj_map(cat.next, unknown); // notify children.
  27. }
  28. if(cat.has){
  29. if()
  30. }
  31. return;
  32. }
  33. if(cat.soul){
  34. return;
  35. }
  36. if(cat.has){
  37. return;
  38. }
  39. if(cat.get){
  40. return;
  41. }
  42. ev.to.next(msg);
  43. }
  44. function unknown(ref, key){
  45. (ref = (ref._)).put = u;
  46. ref.on('in', {get: key, put: u, gun: ref.gun});
  47. }
  48. gun.get('users').map().map().get('who').get('say').map().on(cb);