Skip to content

Commit 9e7d05d

Browse files
committed
fix failing tests, simplify infra
1 parent 4109ba5 commit 9e7d05d

21 files changed

+4130
-1928
lines changed

.babelrc

Lines changed: 0 additions & 24 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 84 deletions
This file was deleted.

.flowconfig

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/Worker.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
var ps = require('child_process');
1+
const ps = require('child_process');
22

33
function Worker(url) {
4-
var that = this;
5-
this.process = ps.fork(url);
6-
this.process.on('message', function (msg) {
7-
if (that.onmessage) {
8-
that.onmessage({ data: JSON.parse(msg) });
9-
}
10-
});
11-
this.process.on('error', function (err) {
12-
if (that.onerror) {
13-
that.onerror(err);
14-
}
15-
});
4+
const that = this;
5+
this.process = ps.fork(url);
6+
this.process.on('message', msg => {
7+
if (that.onmessage) {
8+
that.onmessage({ data: JSON.parse(msg) });
9+
}
10+
});
11+
this.process.on('error', err => {
12+
if (that.onerror) {
13+
that.onerror(err);
14+
}
15+
});
1616
}
1717

1818
Worker.prototype.onmessage = null;
1919
Worker.prototype.onerror = null;
2020

21-
Worker.prototype.postMessage = function (obj) {
22-
this.process.send(JSON.stringify({ data: obj }));
21+
Worker.prototype.postMessage = function(obj) {
22+
this.process.send(JSON.stringify({ data: obj }));
2323
};
2424

25-
Worker.prototype.terminate = function () {
26-
this.process.kill();
25+
Worker.prototype.terminate = function() {
26+
this.process.kill();
2727
};
2828

29-
module.exports = Worker;
29+
module.exports = Worker;

lib/eval.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
var isNode = typeof module !== 'undefined' && module.exports;
1+
/* eslint no-eval: off, no-restricted-globals: off */
2+
3+
const isNode = typeof module !== 'undefined' && module.exports;
24

35
if (isNode) {
4-
process.once('message', function (code) {
5-
eval(JSON.parse(code).data);
6-
});
6+
process.once('message', code => {
7+
eval(JSON.parse(code).data);
8+
});
79
} else {
8-
self.onmessage = function (code) {
9-
eval(code.data);
10-
};
11-
}
10+
self.onmessage = function onmessage(code) {
11+
eval(code.data);
12+
};
13+
}

0 commit comments

Comments
 (0)