Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit f7bcd8f

Browse files
Fix sql.js v1.0 support in browser
1 parent efe1a5f commit f7bcd8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/driver/sqljs/SqljsDriver.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {ObjectLiteral} from "../../common/ObjectLiteral";
1212

1313
// This is needed to satisfy the typescript compiler.
1414
interface Window {
15-
SQL: any;
15+
SQL?: any;
16+
initSqlJs?: any;
1617
localforage: any;
1718
}
1819
declare var window: Window;
@@ -273,7 +274,7 @@ export class SqljsDriver extends AbstractSqliteDriver {
273274
*/
274275
protected loadDependencies(): void {
275276
if (PlatformTools.type === "browser") {
276-
this.sqlite = window.SQL;
277+
this.sqlite = window.SQL || window.initSqlJs;
277278
}
278279
else {
279280
try {
@@ -284,4 +285,4 @@ export class SqljsDriver extends AbstractSqliteDriver {
284285
}
285286
}
286287
}
287-
}
288+
}

0 commit comments

Comments
 (0)