@@ -14,16 +14,16 @@ Table column object type definitions are not yet available in JavaScript.
14
14
15
15
``` js
16
16
import { wrapPowerSyncWithKysely } from ' @powersync/kysely-driver' ;
17
- import { WASQLitePowerSyncDatabaseOpenFactory } from ' @powersync/web' ;
17
+ import { PowerSyncDatabase } from ' @powersync/web' ;
18
18
import { appSchema } from ' ./schema' ;
19
19
20
- const factory = new WASQLitePowerSyncDatabaseOpenFactory ({
20
+ export const powerSyncDb = new PowerSyncDatabase ({
21
+ database: {
22
+ dbFilename: ' test.sqlite'
23
+ },
21
24
schema: appSchema,
22
- dbFilename: ' test.sqlite'
23
25
});
24
26
25
- export const powerSyncDb = factory .getInstance ();
26
-
27
27
export const db = wrapPowerSyncWithKysely (powerSyncDb);
28
28
```
29
29
@@ -32,7 +32,7 @@ See an [example](https://github.com/powersync-ja/powersync-js/blob/main/demos/re
32
32
33
33
``` TypeScript
34
34
import { wrapPowerSyncWithKysely } from ' @powersync/kysely-driver' ;
35
- import { WASQLitePowerSyncDatabaseOpenFactory } from " @powersync/web" ;
35
+ import { PowerSyncDatabase } from " @powersync/web" ;
36
36
37
37
// Define schema as in: https://docs.powersync.com/usage/installation/client-side-setup/define-your-schema
38
38
import { appSchema } from " ./schema" ;
@@ -46,13 +46,13 @@ export type Database = {
46
46
lists: ListsRecord ; // Interface defined externally for list item object
47
47
};
48
48
49
- const factory = new WASQLitePowerSyncDatabaseOpenFactory ({
49
+ export const powerSyncDb = new PowerSyncDatabase ({
50
+ database: {
51
+ dbFilename: " test.sqlite"
52
+ },
50
53
schema: appSchema ,
51
- dbFilename: " test.sqlite" ,
52
54
});
53
55
54
- export const powerSyncDb = factory .getInstance ();
55
-
56
56
// `db` now automatically contains types for defined tables
57
57
export const db = wrapPowerSyncWithKysely <Database >(powerSyncDb )
58
58
```
0 commit comments