1 | // The worker we construct depends on the environment we're in (nodejs or webbrowser);
|
2 |
|
3 | let ChessWorker = null;
|
4 | try {
|
5 | // Reference error if in nodejs
|
6 | ChessWorker = Worker;
|
7 | } catch (e) {
|
8 | ChessWorker = require('tiny-worker');
|
9 | }
|
10 |
|
11 | const rootDir = `${__dirname.replace('ctrl', '')}/`;
|
12 | const path =`${rootDir}vendor/scalachessjs/scalachess.js`;
|
13 |
|
14 | module.exports = function makeChessWorker() {
|
15 | return new ChessWorker(path);
|
16 | } |
\ | No newline at end of file |