Skip to content

Commit e80c405

Browse files
committed
Changelog
1 parent d98a06f commit e80c405

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

PowerSync/PowerSync.Common/CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# PowerSync.Common Changelog
22

3+
## 0.0.11-alpha.1
4+
5+
- Changed the `PowerSyncDatabase.Watch` syntax to return an IAsyncEnumerable instead of accepting a callback. This allows users to handle database changes when they are ready instead of us eagerly running the callback as soon as a change is detected.
6+
7+
```csharp
8+
// Optional cancellation token
9+
var cts = new CancellationTokenSource();
10+
11+
// Register listener synchronously on the calling thread...
12+
var listener = db.Watch<Todo>(
13+
"SELECT * FROM todos",
14+
[],
15+
new SQLWatchOptions { Signal = cts.Token }
16+
);
17+
18+
// ...then listen to changes on another thread
19+
_ = Task.Run(async () =>
20+
{
21+
await foreach (var result in listener)
22+
{
23+
Console.WriteLine($"Number of todos: {result.Length}");
24+
}
25+
}, cts.Token);
26+
27+
// Stop watching by cancelling token
28+
cts.Cancel();
29+
```
30+
331
## 0.0.10-alpha.1
432

533
- Fixed watched queries sometimes resolving to the wrong underlying tables after a schema change.

0 commit comments

Comments
 (0)