Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/index.js b/src/index.js
index 298f961..53cbf2e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,6 +2,7 @@ import * as panzoom from './modules/pan-zoom.js';
import * as gameboard from './modules/gameboard.js';
import * as recordSheet from './modules/record_sheet.js';
import * as mapSelectDialog from './modules/map_select_dialog.js';
+import { Observable } from './modules/observable.js';
globalThis.svgns = 'http://www.w3.org/2000/svg';
@@ -131,7 +132,7 @@ document.querySelectorAll('.end-turn').forEach(el =>
clearMoveEndedIndicators(opponentRecords);
gameboard.clearFiringArcs(opponent);
- gameboard.select(firstOpponentRecord);
+ Observable.notify('select', firstOpponentRecord);
})
);
@@ -157,12 +158,11 @@ gameboard.setDistanceCallback((count = '-') => {
distanceOutput.style.display = count === '-' ? 'none' : 'block';
});
-gameboard.setProneFlagCallback(checked => proneToggle.checked = checked);
+Observable.subscribe('proneflag', checked => proneToggle.checked = checked);
-document.querySelectorAll('.end-move').forEach(el => el.addEventListener('click', () => {
- recordSheet.endMove();
- gameboard.endMove();
-}));
+document.querySelectorAll('.end-move').forEach(el =>
+ el.addEventListener('click', () => Observable.notify('endmove'))
+);
document.querySelector('#fullscreen').addEventListener('click', () => {
if (!document.fullscreenElement) {