@live-change/framework
Advanced tools
Comparing version 0.3.29 to 0.3.30
@@ -8,3 +8,3 @@ | ||
const bucketSize = 25 //6 | ||
const bucketSize = 256 | ||
const saveStateThrottle = 2000 | ||
@@ -64,2 +64,4 @@ const saveStateDelay = saveStateThrottle + 200 | ||
this.readingMore = true | ||
this.lastStateSave = 0 | ||
@@ -133,11 +135,10 @@ this.saveStateTimer = null | ||
} | ||
this.queueWritePromise = new Promise((resolve, reject) => { | ||
this.queueWriteResolve = { resolve, reject } | ||
}) | ||
const operations = this.queue | ||
if(operations.length == 0) { | ||
console.log("NO OPERATIONS") | ||
this.lastUpdateId = this.queueLastUpdateId | ||
return | ||
} | ||
this.queueWritePromise = new Promise((resolve, reject) => { | ||
this.queueWriteResolve = { resolve, reject } | ||
}) | ||
const queueResolve = this.queueWriteResolve | ||
@@ -209,6 +210,9 @@ this.queueWriteResolve = null | ||
this.queueLastUpdateId = lastUpdateId | ||
//console.log("WRITE OPS!") | ||
await this.doWrite() | ||
//console.log("OPS WRITTEN!") | ||
} | ||
observeMore() { | ||
this.readingMore = true | ||
if(this.observable) this.observable.unobserve(this) | ||
@@ -222,14 +226,17 @@ this.observable = this.dao.observable( | ||
} | ||
tryObserveMore() { | ||
if(!this.readingMore && this.observable.list.length == bucketSize) { | ||
this.observeMore() | ||
} | ||
} | ||
async set(ops) { | ||
this.readingMore = false | ||
console.log("SET", this.lastUpdateId, ops.length) | ||
await this.applyOps(ops) | ||
if(this.observable.list.length == bucketSize) { | ||
this.observeMore() | ||
} | ||
this.tryObserveMore() | ||
} | ||
async putByField(_fd, id, op, _reverse, oldObject) { | ||
this.readingMore = false | ||
await this.applyOps([ op ]) | ||
if(this.observable.list.length == bucketSize) { | ||
this.observeMore() | ||
} | ||
this.tryObserveMore() | ||
} | ||
@@ -246,3 +253,5 @@ | ||
}]) | ||
console.log("OPS", ops.length) | ||
await this.applyOps(ops) | ||
console.log("OPS APPLIED", ops.length) | ||
} while(ops.length >= bucketSize) | ||
@@ -249,0 +258,0 @@ } |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.3.29", | ||
"version": "0.3.30", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132139
3628