braid-text 0.2.89 → 0.2.90
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/index.js +8 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -268,8 +268,8 @@ function create_braid_text() {
|
|
|
268
268
|
// Wait for remote_res to be available
|
|
269
269
|
await remote_res_promise
|
|
270
270
|
|
|
271
|
-
// Check if this is a dt-encoded update
|
|
272
|
-
if (
|
|
271
|
+
// Check if this is a dt-encoded update
|
|
272
|
+
if (update.extra_headers?.encoding === 'dt') {
|
|
273
273
|
var cv = remote_res.headers.get('current-version')
|
|
274
274
|
await braid_text.put(a, {
|
|
275
275
|
body: update.body,
|
|
@@ -829,7 +829,7 @@ function create_braid_text() {
|
|
|
829
829
|
|
|
830
830
|
if (options.transfer_encoding === 'dt') {
|
|
831
831
|
var start_i = 1 + resource.doc.getLocalVersion().reduce((a, b) => Math.max(a, b), -1)
|
|
832
|
-
|
|
832
|
+
|
|
833
833
|
resource.doc.mergeBytes(body)
|
|
834
834
|
|
|
835
835
|
var end_i = resource.doc.getLocalVersion().reduce((a, b) => Math.max(a, b), -1)
|
|
@@ -842,6 +842,11 @@ function create_braid_text() {
|
|
|
842
842
|
resource.version = resource.doc.getRemoteVersion().map(x => x.join("-")).sort()
|
|
843
843
|
|
|
844
844
|
await resource.db_delta(body)
|
|
845
|
+
|
|
846
|
+
// Notify non-simpleton clients with the dt-encoded update
|
|
847
|
+
var dt_update = { body, encoding: 'dt' }
|
|
848
|
+
await Promise.all([...resource.clients].map(client => client.my_subscribe(dt_update)))
|
|
849
|
+
|
|
845
850
|
return { change_count: end_i - start_i + 1 }
|
|
846
851
|
}
|
|
847
852
|
|