Skip to content

Commit b880882

Browse files
committed
Fix the worker code so that it doesnt depend on the global SQL variable
1 parent 515e39c commit b880882

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/worker.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
/* global SQL initSqlJs */
1+
/* global initSqlJs */
22
/* eslint-env worker */
33
/* eslint no-restricted-globals: ["error"] */
44
var db;
55

6-
function createDb(data) {
6+
function onModuleReady(SQL) {
77
"use strict";
88

9-
if (db != null) {
10-
db.close();
9+
function createDb(data) {
10+
if (db != null) db.close();
11+
db = new SQL.Database(data);
12+
return db;
1113
}
12-
db = new SQL.Database(data);
13-
return db;
14-
}
15-
16-
function onModuleReady() {
17-
"use strict";
1814

1915
var buff; var data; var result;
2016
data = this["data"];

0 commit comments

Comments
 (0)