braid-text 0.2.84 → 0.2.85
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 +5 -2
- package/package.json +1 -1
- package/test/tests.js +2 -2
package/index.js
CHANGED
|
@@ -108,7 +108,7 @@ function create_braid_text() {
|
|
|
108
108
|
|
|
109
109
|
connect()
|
|
110
110
|
async function connect() {
|
|
111
|
-
if (options.
|
|
111
|
+
if (options.on_pre_connect) await options.on_pre_connect()
|
|
112
112
|
|
|
113
113
|
if (closed) return
|
|
114
114
|
|
|
@@ -187,7 +187,10 @@ function create_braid_text() {
|
|
|
187
187
|
await braid_text.put(a, update)
|
|
188
188
|
extend_fork_point(update)
|
|
189
189
|
},
|
|
190
|
-
on_error:
|
|
190
|
+
on_error: e => {
|
|
191
|
+
options.on_disconnect?.()
|
|
192
|
+
handle_error(e)
|
|
193
|
+
}
|
|
191
194
|
}
|
|
192
195
|
// Handle case where remote doesn't exist yet - wait for local to create it
|
|
193
196
|
var remote_result = await braid_text.get(b, b_ops)
|
package/package.json
CHANGED
package/test/tests.js
CHANGED
|
@@ -46,7 +46,7 @@ runTest(
|
|
|
46
46
|
var ac = new AbortController()
|
|
47
47
|
braid_text.sync('/${key}', new URL('http://localhost:8889/have_error'), {
|
|
48
48
|
signal: ac.signal,
|
|
49
|
-
|
|
49
|
+
on_pre_connect: () => {
|
|
50
50
|
count++
|
|
51
51
|
if (count === 2) {
|
|
52
52
|
res.end('it reconnected!')
|
|
@@ -198,7 +198,7 @@ runTest(
|
|
|
198
198
|
var ac = new AbortController()
|
|
199
199
|
braid_text.sync('/${key_a}', new URL('http://localhost:8889/have_error'), {
|
|
200
200
|
signal: ac.signal,
|
|
201
|
-
|
|
201
|
+
on_pre_connect: () => {
|
|
202
202
|
count++
|
|
203
203
|
if (count === 2) {
|
|
204
204
|
res.end('it reconnected!')
|