Skip to content

Commit afa1f43

Browse files
Small fixes (#186)
* Fix syntax issues * Fix indentation
1 parent 89f42ce commit afa1f43

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

client-sdk-references/javascript-web.mdx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -161,30 +161,25 @@ Accordingly, the connector must implement two methods:
161161
import { UpdateType } from '@powersync/web';
162162

163163
export class Connector {
164+
async fetchCredentials() {
165+
// Implement fetchCredentials to obtain a JWT from your authentication service.
166+
// See https://docs.powersync.com/installation/authentication-setup
167+
// If you're using Supabase or Firebase, you can re-use the JWT from those clients, see
168+
// - https://docs.powersync.com/installation/authentication-setup/supabase-auth
169+
// - https://docs.powersync.com/installation/authentication-setup/firebase-auth
170+
return {
171+
endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
172+
// Use a development token (see Authentication Setup https://docs.powersync.com/installation/authentication-setup/development-tokens) to get up and running quickly
173+
token: 'An authentication token'
174+
};
175+
}
164176

165-
constructor() {
166-
// Setup a connection to your server for uploads
167-
this.serverConnectionClient = TODO;
168-
}
169-
170-
async fetchCredentials() {
171-
// Implement fetchCredentials to obtain a JWT from your authentication service.
172-
// See https://docs.powersync.com/installation/authentication-setup
173-
// If you're using Supabase or Firebase, you can re-use the JWT from those clients, see
174-
// - https://docs.powersync.com/installation/authentication-setup/supabase-auth
175-
// - https://docs.powersync.com/installation/authentication-setup/firebase-auth
176-
return {
177-
endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
178-
// Use a development token (see Authentication Setup https://docs.powersync.com/installation/authentication-setup/development-tokens) to get up and running quickly
179-
token: 'An authentication token'
180-
};
181-
}
182-
183-
async uploadData(database) {
177+
async uploadData(database) {
184178
// Implement uploadData to send local changes to your backend service.
185179
// You can omit this method if you only want to sync data from the database to the client
186180

187181
// See example implementation here: https://docs.powersync.com/client-sdk-references/javascript-web#3-integrate-with-your-backend
182+
}
188183
}
189184
```
190185

@@ -232,14 +227,14 @@ The [watch](https://powersync-ja.github.io/powersync-js/web-sdk/classes/PowerSyn
232227
const abortController = new AbortController();
233228

234229
export const function watchLists = (onUpdate) => {
235-
for await (const update of PowerSync.watch(
236-
'SELECT * from lists',
237-
[],
238-
{ signal: abortController.signal }
239-
)
240-
) {
241-
onUpdate(update);
242-
}
230+
for await (const update of PowerSync.watch(
231+
'SELECT * from lists',
232+
[],
233+
{ signal: abortController.signal }
234+
)
235+
) {
236+
onUpdate(update);
237+
}
243238
}
244239
```
245240

0 commit comments

Comments
 (0)