Require Stockfish

Here’s what the API docs say:

In a web browser, Stockfish.js can be run in a web-worker, which can be created like this:

var stockfish = new Worker("stockfish.js");

The output of the engine is again posted as a message. To receive it, you need to add a message handler:

stockfish.onmessage = function onmessage(event) {
    console.log(event.data);
};

Input (standard UCI commands) to the engine is posted as a message to the worker:

stockfish.postMessage("go depth 15");