braid-text 0.3.17 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/simpleton-sync.js +10 -7
- package/package.json +1 -1
package/client/simpleton-sync.js
CHANGED
|
@@ -118,7 +118,7 @@ function simpleton_client(url, {
|
|
|
118
118
|
var outstanding_changes = 0 // PUTs sent, not yet ACKed
|
|
119
119
|
var max_outstanding_changes = 10 // throttle limit
|
|
120
120
|
var throttled = false
|
|
121
|
-
var
|
|
121
|
+
var throttled_updates = []
|
|
122
122
|
var ac = new AbortController()
|
|
123
123
|
|
|
124
124
|
// ── Subscription (GET) ──────────────────────────────────────────────
|
|
@@ -150,8 +150,11 @@ function simpleton_client(url, {
|
|
|
150
150
|
// parents match our client_version exactly. This ensures
|
|
151
151
|
// we stay on a single line of time.
|
|
152
152
|
update.parents.sort()
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
var last_queued = throttled_updates.length
|
|
154
|
+
? throttled_updates[throttled_updates.length - 1].version
|
|
155
|
+
: client_version
|
|
156
|
+
if (versions_eq(last_queued, update.parents))
|
|
157
|
+
if (throttled) throttled_updates.push(update)
|
|
155
158
|
else await apply_update(update)
|
|
156
159
|
}, on_error)
|
|
157
160
|
}).catch(on_error)
|
|
@@ -265,10 +268,10 @@ function simpleton_client(url, {
|
|
|
265
268
|
if (!change) {
|
|
266
269
|
if (throttled) {
|
|
267
270
|
throttled = false
|
|
268
|
-
|
|
269
|
-
versions_eq(client_version,
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
for (var update of throttled_updates)
|
|
272
|
+
if (versions_eq(client_version, update.parents))
|
|
273
|
+
apply_update(update).catch(on_error)
|
|
274
|
+
throttled_updates = []
|
|
272
275
|
}
|
|
273
276
|
return
|
|
274
277
|
}
|