You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns an async iterator of completed transactions with local writes against the database.
641
+
*
642
+
* This is typically used from the {@link PowerSyncBackendConnector.uploadData} callback. Each entry emitted by the
643
+
* returned iterator is a full transaction containing all local writes made while that transaction was active.
644
+
*
645
+
* Unlike {@link getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
646
+
* {@link CrudTransaction.complete}d yet, this iterator can be used to receive multiple transactions. Calling
647
+
* {@link CrudTransaction.complete} will mark that and all prior transactions emitted by the iterator as completed.
648
+
*
649
+
* This can be used to upload multiple transactions in a single batch, e.g with:
650
+
*
651
+
* ```JavaScript
652
+
* let lastTransaction = null;
653
+
* let batch = [];
654
+
*
655
+
* for await (const transaction of database.getCrudTransactions()) {
656
+
* batch.push(...transaction.crud);
657
+
* lastTransaction = transaction;
658
+
*
659
+
* if (batch.length > 10) {
660
+
* break;
661
+
* }
662
+
* }
663
+
* ```
664
+
*
665
+
* If there is no local data to upload, the async iterator complete without emitting any items.
666
+
*
667
+
* Note that iterating over async iterables requires a [polyfill](https://github.com/powersync-ja/powersync-js/tree/main/packages/react-native#babel-plugins-watched-queries)
0 commit comments