Attempt to clarify installation instructions a little
[vchess.git] / client / src / playCompMove.js
index d8dd2d4..d83148f 100644 (file)
@@ -2,8 +2,8 @@
 onmessage = async function(e) {
   switch (e.data[0]) {
     case "scripts": {
-      const vModule = await import("@/variants/" + e.data[1] + ".js");
-      self.V = vModule.VariantRules;
+      await import("@/variants/" + e.data[1] + ".js")
+      .then((vModule) => { self.V = vModule[e.data[1] + "Rules"]; });
       break;
     }
     case "init": {
@@ -12,7 +12,11 @@ onmessage = async function(e) {
       break;
     }
     case "newmove":
-      self.vr.play(e.data[1]);
+      let move = e.data[1];
+      // Caution: could be a multi-move
+      if (!Array.isArray(move))
+        move = [move];
+      move.forEach(m => self.vr.play(m));
       break;
     case "askmove": {
       const compMove = self.vr.getComputerMove();