I use a Web Worker in my JavaScript code, the class in which I use the Worker looks as follows:
class EnemyMoveCalculater { constructor() { this.worker = null; } startMoveCalculation(boardData, nextPlayer, jokerReady, enemyMoveHandlerCallback) { this.worker = new Worker('js/calculateEnemyMoves.js'); this.worker.onmessage = function(e) { this.worker.terminate(); this.worker = null; enemyMoveHandlerCallback(e.data); }.bind(this); this.worker.postMessage([boardData, nextPlayer, jokerReady]); } terminateMoveCalculation() { if (this.worker) this.worker.terminate(); } } My Website is working in Firefox (for Windows and Android), Edge and Samsung Internet Browser. However, when the "startMoveCalculation" runs in Safari (Version 12.1.2) I get the following Error:
ReferenceError: Can't find variable: Worker What could be the problem?