Skip to content

Commit 51dfbb0

Browse files
Christiaan LandmanChristiaan Landman
authored andcommitted
chore: Cleaned up examples to use javascript instead of ts.
1 parent 1bb56be commit 51dfbb0

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

demos/react-native-supabase-todolist/library/powersync/PhotoAttachmentQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class PhotoAttachmentQueue extends AbstractAttachmentQueue {
1818

1919
onAttachmentIdsChange(onUpdate: (ids: string[]) => void): void {
2020
this.powersync.watch(`SELECT photo_id as id FROM ${TODO_TABLE} WHERE photo_id IS NOT NULL`, [], {
21-
onResult: result => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
21+
onResult: (result) => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
2222
});
2323
}
2424

packages/powersync-attachments/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import { AbstractAttachmentQueue } from '@journeyapps/powersync-attachments';
7373
export class AttachmentQueue extends AbstractAttachmentQueue {
7474
onAttachmentIdsChange(onUpdate) {
7575
this.powersync.watch('SELECT photo_id as id FROM checklists WHERE photo_id IS NOT NULL', [], {
76-
onResult: result => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
76+
onResult: (result) => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
7777
});
7878
}
7979
}

packages/powersync-attachments/src/AbstractAttachmentQueue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export abstract class AbstractAttachmentQueue<T extends AttachmentQueueOptions =
6161
* In most cases this will contain a watch query.
6262
*
6363
* @example
64-
* ```typescript
64+
* ```javascript
6565
* onAttachmentIdsChange(onUpdate) {
6666
* this.powersync.watch('SELECT photo_id as id FROM todos WHERE photo_id IS NOT NULL', [], {
67-
* onResult: result => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
67+
* onResult: (result) => onUpdate(result.rows?._array.map((r) => r.id) ?? [])
6868
* });
6969
* }
7070
* ```

packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
557557
* Can be overloaded to use a callback handler instead, for documentation see {@link watchWithCallback}.
558558
*
559559
* @example
560-
* ```typescript
561-
* async *attachmentIds(): AsyncIterable<string[]> {
560+
* ```javascript
561+
* async *attachmentIds() {
562562
* for await (const result of this.powersync.watch(
563563
* `SELECT photo_id as id FROM todos WHERE photo_id IS NOT NULL`,
564564
* []
@@ -573,15 +573,13 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
573573
* See {@link watchWithCallback}.
574574
*
575575
* @example
576-
* ```typescript
577-
* attachmentIds(onResult: (ids: string[]) => void): void {
576+
* ```javascript
577+
* onAttachmentIdsChange(onResult) {
578578
* this.powersync.watch(
579579
* `SELECT photo_id as id FROM todos WHERE photo_id IS NOT NULL`,
580580
* [],
581581
* {
582-
* onResult: (result) => {
583-
* onResult(result.rows?._array.map((r) => r.id) ?? []);
584-
* }
582+
* onResult: (result) => onResult(result.rows?._array.map((r) => r.id) ?? [])
585583
* }
586584
* );
587585
* }
@@ -679,7 +677,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
679677
* Can be overloaded to use a callback handler instead, for documentation see {@link onChangeWithCallback}.
680678
*
681679
* @example
682-
* ```typescript
680+
* ```javascript
683681
* async monitorChanges() {
684682
* for await (const event of this.powersync.onChange({tables: ['todos']})) {
685683
* console.log('Detected change event:', event);
@@ -692,8 +690,8 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
692690
* See {@link onChangeWithCallback}.
693691
*
694692
* @example
695-
* ```typescript
696-
* monitorChanges(): void {
693+
* ```javascript
694+
* monitorChanges() {
697695
* this.powersync.onChange({
698696
* onChange: (event) => {
699697
* console.log('Change detected:', event);

0 commit comments

Comments
 (0)