removed some unnecessary setTimeouts
This commit is contained in:
		
							parent
							
								
									42abcc897c
								
							
						
					
					
						commit
						020dacdad4
					
				| @ -240,11 +240,7 @@ export default function extendConnector (Y/* :any */) { | |||||||
|       } |       } | ||||||
|       if (this.broadcastOpBuffer.length === 0) { |       if (this.broadcastOpBuffer.length === 0) { | ||||||
|         this.broadcastOpBuffer = ops |         this.broadcastOpBuffer = ops | ||||||
|         if (this.y.db.transactionInProgress) { |         this.y.db.whenTransactionsFinished().then(broadcastOperations) | ||||||
|           this.y.db.whenTransactionsFinished().then(broadcastOperations) |  | ||||||
|         } else { |  | ||||||
|           setTimeout(broadcastOperations, 0) |  | ||||||
|         } |  | ||||||
|       } else { |       } else { | ||||||
|         this.broadcastOpBuffer = this.broadcastOpBuffer.concat(ops) |         this.broadcastOpBuffer = this.broadcastOpBuffer.concat(ops) | ||||||
|       } |       } | ||||||
| @ -365,6 +361,7 @@ export default function extendConnector (Y/* :any */) { | |||||||
|               */ |               */ | ||||||
|               defer.resolve() |               defer.resolve() | ||||||
|             }) |             }) | ||||||
|  |             return this.syncStep2 | ||||||
|           } else if (message.type === 'sync done') { |           } else if (message.type === 'sync done') { | ||||||
|             var self = this |             var self = this | ||||||
|             this.syncStep2.then(function () { |             this.syncStep2.then(function () { | ||||||
|  | |||||||
							
								
								
									
										16
									
								
								src/y.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/y.js
									
									
									
									
									
								
							| @ -132,16 +132,14 @@ export default function Y (opts/* :YOptions */) /* :Promise<YConfig> */ { | |||||||
|       opts.connector = Y.utils.copyObject(opts.connector) |       opts.connector = Y.utils.copyObject(opts.connector) | ||||||
|       opts.db = Y.utils.copyObject(opts.db) |       opts.db = Y.utils.copyObject(opts.db) | ||||||
|       opts.share = Y.utils.copyObject(opts.share) |       opts.share = Y.utils.copyObject(opts.share) | ||||||
|       setTimeout(function () { |       Y.requestModules(modules).then(function () { | ||||||
|         Y.requestModules(modules).then(function () { |         var yconfig = new YConfig(opts) | ||||||
|           var yconfig = new YConfig(opts) |         yconfig.db.whenUserIdSet(function () { | ||||||
|           yconfig.db.whenUserIdSet(function () { |           yconfig.init(function () { | ||||||
|             yconfig.init(function () { |             resolve(yconfig) | ||||||
|               resolve(yconfig) |  | ||||||
|             }) |  | ||||||
|           }) |           }) | ||||||
|         }).catch(reject) |         }) | ||||||
|       }, 0) |       }).catch(reject) | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user