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

Commit

Permalink
Fix sql.js v1.0 support in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jun 18, 2019
1 parent efe1a5f commit f7bcd8f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/driver/sqljs/SqljsDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {ObjectLiteral} from "../../common/ObjectLiteral";

// This is needed to satisfy the typescript compiler.
interface Window {
SQL: any;
SQL?: any;
initSqlJs?: any;
localforage: any;
}
declare var window: Window;
Expand Down Expand Up @@ -273,7 +274,7 @@ export class SqljsDriver extends AbstractSqliteDriver {
*/
protected loadDependencies(): void {
if (PlatformTools.type === "browser") {
this.sqlite = window.SQL;
this.sqlite = window.SQL || window.initSqlJs;
}
else {
try {
Expand All @@ -284,4 +285,4 @@ export class SqljsDriver extends AbstractSqliteDriver {
}
}
}
}
}

0 comments on commit f7bcd8f

Please sign in to comment.