| 357 | * @param mutations - Array of mutation objects from the transaction |
| 358 | */ |
| 359 | const confirmOperationsSync = (mutations: Array<PendingMutation<T>>) => { |
| 360 | if (!syncBegin || !syncWrite || !syncCommit) { |
| 361 | return // Sync not initialized yet, which is fine |
| 362 | } |
| 363 | |
| 364 | // Immediately write back through sync interface |
| 365 | syncBegin() |
| 366 | mutations.forEach((mutation) => { |
| 367 | if (syncWrite) { |
| 368 | syncWrite({ |
| 369 | type: mutation.type, |
| 370 | value: mutation.modified, |
| 371 | }) |
| 372 | } |
| 373 | }) |
| 374 | syncCommit() |
| 375 | } |
| 376 | |
| 377 | return { |
| 378 | sync, |