graph-database.js
/**
   Transfer an object's state to the remote store.
   The state is staged as a patch in a GraphRequest, which is added to this store's collection
   and returned to the application.
   Once control returns to the promise, the patch is collected and once all requests
   are processed, the collected patched are commited.
   @param {Object} object
   */
Transfer an object's state to the remote store.
The state is staged as a patch in a GraphRequest, which is added to this store's collection
and returned to the application.
Once control returns to the promise, the patch is collected and once all requests
are processed, the collected patched are commited.
Transfer an object ' s state to the remote store . The state is staged as a patch in a GraphRequest which is added to this store ' s collection and returned to the application . Once control returns to the promise the patch is collected and once all requests are processed the collected patched are commited .
put(object) {  
    var thisStore = this;
    var request = new PutRequest(this, thisStore.transaction);
    var patch = object.asPatch();
    console.log("GDBObjectStore.put", object._state, patch, request);
    object._state = object.stateNew;
    var p = new Promise(function(accept, reject) {
      request.patch = patch;
      request.result = object;
      thisStore.requests.push(request);
      accept(request);
    });
    p.then(function(requestIgnored) {
      for (request = thisStore.requests.shift();
           request;
           request = thisStore.requests.shift()) {
        thisStore.patches.push(request.patch);
        request.readyState = "complete";
        if (request.onsuccess) {
          request.onsuccess(new SuccessEvent("success", "put", request.result));
        }
      }
      thisStore.transaction.commitIfComplete();
      return(request);
    }, null);
    return( request );
  }
put ( object ) { var thisStore = this ; var request = new PutRequest ( this , thisStore . transaction ) ; var patch = object . asPatch ( ) ; console . log ( "GDBObjectStore.put" , object . _state , patch , request ) ; object . _state = object . stateNew ; var p = new Promise ( function ( accept , reject ) { request . patch = patch ; request . result = object ; thisStore . requests . push ( request ) ; accept ( request ) ; } ) ; p . then ( function ( requestIgnored ) { for ( request = thisStore . requests . shift ( ) ; request ; request = thisStore . requests . shift ( ) ) { thisStore . patches . push ( request . patch ) ; request . readyState = "complete" ; if ( request . onsuccess ) { request . onsuccess ( new SuccessEvent ( "success" , "put" , request . result ) ) ; } } thisStore . transaction . commitIfComplete ( ) ; return ( request ) ; } , null ) ; return ( request ) ; }
Transfer an object's state to the remote store.
Transfer an object ' s state to the remote store .
// single level // allow the onsuccess to push more requests