@abraca/dabra 1.0.25 → 1.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "1.0.25",
3
+ "version": "1.1.0",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -419,6 +419,19 @@ export class BackgroundSyncManager extends EventEmitter {
419
419
  await childProvider.ready;
420
420
  await this._waitForSynced(childProvider);
421
421
 
422
+ // Emit docSynced while the child is still loaded so listeners can
423
+ // extract data (search text, file refs) without opening a new IDB.
424
+ {
425
+ const treeMap = this.rootProvider.document.getMap("doc-tree") as Y.Map<any>;
426
+ const treeEntry = treeMap.get(docId);
427
+ this.emit("docSynced", {
428
+ docId,
429
+ document: childProvider.document,
430
+ label: treeEntry?.label ?? "",
431
+ meta: treeEntry?.meta,
432
+ });
433
+ }
434
+
422
435
  // Prefetch file blobs
423
436
  if (this.opts.prefetchFiles && this.fileBlobStore) {
424
437
  this._prefetchDocFiles(docId, childProvider.document).catch(() => null);
@@ -458,6 +471,19 @@ export class BackgroundSyncManager extends EventEmitter {
458
471
  await childProvider.ready;
459
472
  await this._waitForSynced(childProvider);
460
473
 
474
+ // Emit docSynced while the child is still alive so listeners can
475
+ // extract data without opening a new IDB connection.
476
+ {
477
+ const treeMap = this.rootProvider.document.getMap("doc-tree") as Y.Map<any>;
478
+ const treeEntry = treeMap.get(docId);
479
+ this.emit("docSynced", {
480
+ docId,
481
+ document: childDoc,
482
+ label: treeEntry?.label ?? "",
483
+ meta: treeEntry?.meta,
484
+ });
485
+ }
486
+
461
487
  if (this.opts.prefetchFiles && this.fileBlobStore) {
462
488
  this._prefetchDocFiles(docId, childDoc).catch(() => null);
463
489
  }