graph-database.js
/**
   Register an object - and its reachability graph, to cause any changes within a
   transaction to propagate to the remote store when the transaction commits.
   */
Register an object - and its reachability graph, to cause any changes within a
transaction to propagate to the remote store when the transaction commits.
Register an object - and its reachability graph to cause any changes within a transaction to propagate to the remote store when the transaction commits .
attach(object) {
    var thisStore = this;
    var store = object._store;
    if (store) {
    } else if (object instanceof GraphObject) {
      var objects = thisStore.objects;
      var attachChild = function(child) {
        if (child instanceof GraphObject) {
          thisStore.attach(object);
        } else if (child instanceof Array) {
          child.forEach(attachChild);
        }
      }
      if (! objects.has(object.getIdentifier())) {
        objects.set(object.getIdentifier(), object);
        object._store = thisStore;
        object._transaction = thisStore.transaction;
        object.persistentValues(object).forEach(attachChild);
      }
    }
    return (object);
  }
attach ( object ) { var thisStore = this ; var store = object . _store ; if ( store ) { } else if ( object instanceof GraphObject ) { var objects = thisStore . objects ; var attachChild = function ( child ) { if ( child instanceof GraphObject ) { thisStore . attach ( object ) ; } else if ( child instanceof Array ) { child . forEach ( attachChild ) ; } } if ( ! objects . has ( object . getIdentifier ( ) ) ) { objects . set ( object . getIdentifier ( ) , object ) ; object . _store = thisStore ; object . _transaction = thisStore . transaction ; object . persistentValues ( object ) . forEach ( attachChild ) ; } } return ( object ) ; }
Register an object - and its reachability graph, to cause any changes within a
transaction to propagate to the remote store when the transaction commits.
Register an object - and its reachability graph to cause any changes within a transaction to propagate to the remote store when the transaction commits .
// attach the instance to a store // no error, just stop walking //if (transaction != this) { //  throw new Error(`Object is already attached: ${this}, ${object}.`); //} else {} //console.log('attached');