File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ import { GameBase } from "./game-base";
22import { calculateBestMove } from "./ai/process" ;
33import { WorkerOutgoingMessage } from "./types-worker" ;
44
5+ // see https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/postMessage
6+ // we wouldn't need this workaround if we could have a separate typescript config just for
7+ // the worker.
8+ declare function postMessage ( messagse : any ) ;
9+
510onmessage = function ( this : Window , ev : MessageEvent ) {
611 let data = ev . data ;
712 if ( data . task === "processAI" ) {
@@ -13,6 +18,6 @@ onmessage = function(this: Window, ev: MessageEvent) {
1318 task : "processAI" ,
1419 result,
1520 } ;
16- this . postMessage ( msg , null ) ;
21+ postMessage ( msg ) ;
1722 }
1823} ;
You can’t perform that action at this time.
0 commit comments