web: add support for multiple browser tabs & windows

This commit is contained in:
Abdullah Atta
2024-03-28 09:50:32 +05:00
parent ec00779062
commit 751af3c2d1
6 changed files with 493 additions and 24 deletions

View File

@@ -32,12 +32,16 @@ declare module "kysely" {
}
}
export const createDialect = (name: string): Dialect => {
export const createDialect = (
name: string,
init?: () => Promise<void>
): Dialect => {
return {
createDriver: () =>
new WaSqliteWorkerDriver({
async: !isFeatureSupported("opfs"),
dbName: name
dbName: name,
init
}),
createAdapter: () => new SqliteAdapter(),
createIntrospector: (db) => new SqliteIntrospector(db),