UNPKG

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