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.
@@ -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 throttled_update = null
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
- if (versions_eq(client_version, update.parents))
154
- if (throttled) throttled_update = update
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
- if (throttled_update &&
269
- versions_eq(client_version, throttled_update.parents))
270
- apply_update(throttled_update).catch(on_error)
271
- throttled_update = null
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-text",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Library for collaborative text over http using braid.",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braid-text",