starting to implement new sharedObjects idea
This commit is contained in:
		
							parent
							
								
									f6c5051472
								
							
						
					
					
						commit
						8d14a9cbba
					
				@ -186,10 +186,13 @@ module.exports = function (Y /* :any */) {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    getNextOpId () {
 | 
					    getNextOpId () {
 | 
				
			||||||
      if (this.userId == null) {
 | 
					      if (this._temporaryUserIdGenerator != null) {
 | 
				
			||||||
 | 
					        return this._temporaryUserIdGenerator()
 | 
				
			||||||
 | 
					      } else if (this.userId == null) {
 | 
				
			||||||
        throw new Error('OperationStore not yet initialized!')
 | 
					        throw new Error('OperationStore not yet initialized!')
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        return [this.userId, this.opClock++]
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return [this.userId, this.opClock++]
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
      Apply a list of operations.
 | 
					      Apply a list of operations.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								src/y.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/y.js
									
									
									
									
									
								
							@ -111,18 +111,14 @@ class YConfig {
 | 
				
			|||||||
    this.connector = new Y[opts.connector.name](this, opts.connector)
 | 
					    this.connector = new Y[opts.connector.name](this, opts.connector)
 | 
				
			||||||
    this.db.requestTransaction(function * requestTransaction () {
 | 
					    this.db.requestTransaction(function * requestTransaction () {
 | 
				
			||||||
      // create initial Map type
 | 
					      // create initial Map type
 | 
				
			||||||
      var model = {
 | 
					      this.store._temporaryUserIdGenerator = function () {
 | 
				
			||||||
        id: ['_', 0],
 | 
					        return ['_', 0]
 | 
				
			||||||
        struct: 'Map',
 | 
					 | 
				
			||||||
        type: 'Map',
 | 
					 | 
				
			||||||
        map: {}
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      yield* this.store.tryExecute.call(this, model)
 | 
					      var typeid = yield* Y.Map.createType.call(this)
 | 
				
			||||||
      var root = yield* this.getType(model.id)
 | 
					      var type = yield* this.getType(typeid)
 | 
				
			||||||
      this.store.y.root = root
 | 
					      this.store.y.root = type
 | 
				
			||||||
      setTimeout(function () {
 | 
					      this.store._temporaryUserIdGenerator = null
 | 
				
			||||||
        callback()
 | 
					      setTimeout(callback, 0)
 | 
				
			||||||
      }, 0)
 | 
					 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  isConnected () {
 | 
					  isConnected () {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user