braid-text 0.2.57 → 0.2.59

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/README.md CHANGED
@@ -119,7 +119,7 @@ Here's a basic running example to start:
119
119
  </script>
120
120
  ```
121
121
 
122
- You should see something if you run this (though the server in this example will likely ignore your changes).
122
+ You should see some text in a box if you run this, and if you run it in another tab, you should be able to edit that text collaboratively.
123
123
 
124
124
  ### How It Works
125
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-text",
3
- "version": "0.2.57",
3
+ "version": "0.2.59",
4
4
  "description": "Library for collaborative text over http using braid.",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braid-text",
@@ -44,9 +44,11 @@ function simpleton_client(url, {
44
44
  apply_remote_update, // DEPRECATED
45
45
  generate_local_diff_update, // DEPRECATED
46
46
  content_type,
47
+
47
48
  on_error,
48
49
  on_res,
49
- on_ack
50
+ on_ack,
51
+ send_digests
50
52
  }) {
51
53
  var peer = Math.random().toString(36).substr(2)
52
54
  var current_version = []
@@ -56,6 +58,10 @@ function simpleton_client(url, {
56
58
  var max_outstanding_changes = 10
57
59
  var ac = new AbortController()
58
60
 
61
+ // temporary: our old code uses this deprecated api,
62
+ // and our old code wants to send digests..
63
+ if (apply_remote_update) send_digests = true
64
+
59
65
  braid_fetch(url, {
60
66
  headers: { "Merge-Type": "simpleton",
61
67
  ...(content_type ? {Accept: content_type} : {}) },
@@ -181,8 +187,8 @@ function simpleton_client(url, {
181
187
  var r = await braid_fetch(url, {
182
188
  headers: {
183
189
  "Merge-Type": "simpleton",
184
- "Repr-Digest": await get_digest(prev_state),
185
- ...(content_type ? {"Content-Type": content_type} : {})
190
+ ...send_digests && {"Repr-Digest": await get_digest(prev_state)},
191
+ ...content_type && {"Content-Type": content_type}
186
192
  },
187
193
  method: "PUT",
188
194
  retry: (res) => res.status !== 550,