Web Dev Solutions

Catalin Mititiuc

From 0c693a03832c9b47f2ca4c718640e02abce80c71 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Sat, 27 Apr 2024 10:27:54 -0700 Subject: Move function into closure --- src/modules/game.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/game.js b/src/modules/game.js index 2633320..485362b 100644 --- a/src/modules/game.js +++ b/src/modules/game.js @@ -12,10 +12,6 @@ function getGridIndex({ parentElement: { dataset: { x }, parentElement: { datase return { x: +x, y: +y }; } -function getCounterAtGridIndex(x, y) { - return getCell(x, y).querySelector('.counter'); -} - function getHex(cell) { return cell.querySelector('use[href="#hex"]'); } @@ -235,6 +231,10 @@ export default function (svg) { return svg.querySelector(`g[data-y="${y}"] > g[data-x="${x}"]`); } + function getCounterAtGridIndex(x, y) { + return getCell(x, y).querySelector('.counter'); + } + function getSelected() { return svg.querySelector(`.counter.selected[data-allegiance][data-number]`); } -- cgit v1.2.3