diff --git a/examples/rav-moves-table.js b/examples/rav-moves-table.js index 838c707..7d74114 100644 --- a/examples/rav-moves-table.js +++ b/examples/rav-moves-table.js @@ -113,4 +113,4 @@ const gameActionsDropdown = new GameActionsDropdown( } ); -ravMovesTable.domElem(); +ravMovesTable.mount(); diff --git a/examples/san-moves-table.js b/examples/san-moves-table.js index 42622f6..070364b 100644 --- a/examples/san-moves-table.js +++ b/examples/san-moves-table.js @@ -90,4 +90,4 @@ sanMovesTable.props = { fen: fen }; -sanMovesTable.domElem(); +sanMovesTable.mount(); diff --git a/examples/timer-table.js b/examples/timer-table.js index d3c7852..7964fe8 100644 --- a/examples/timer-table.js +++ b/examples/timer-table.js @@ -22,5 +22,5 @@ const timerTable = new TimerTable( ); setInterval(() => { - timerTable.count().domElem(); + timerTable.count().mount(); }, 1000); diff --git a/src/AbstractComponent.js b/src/AbstractComponent.js index b566b79..1c5e13a 100644 --- a/src/AbstractComponent.js +++ b/src/AbstractComponent.js @@ -6,7 +6,7 @@ export default class AbstractComponent { this._el = el; this._props = props; - this.domElem(); + this.mount(); } get props() { @@ -17,7 +17,7 @@ export default class AbstractComponent { this._props = props; } - domElem() { - throw new Error("The domElem() method is an abstract method."); + mount() { + throw new Error("The mount() method is an abstract method."); } } diff --git a/src/GameActionsDropdown.js b/src/GameActionsDropdown.js index 6005293..a6d50a4 100644 --- a/src/GameActionsDropdown.js +++ b/src/GameActionsDropdown.js @@ -2,7 +2,7 @@ import { COLOR } from "https://cdn.jsdelivr.net/npm/cm-chessboard@8.5.0/src/Ches import AbstractComponent from '../src/AbstractComponent.js'; export class GameActionsDropdown extends AbstractComponent { - domElem() { + mount() { this._el.children.item(0).addEventListener('click', (event) => { event.preventDefault(); this._props.movesTable.props.chessboard.setOrientation( diff --git a/src/HistoryButtons.js b/src/HistoryButtons.js index bc1adc6..6353ea3 100644 --- a/src/HistoryButtons.js +++ b/src/HistoryButtons.js @@ -1,13 +1,13 @@ import AbstractComponent from '../src/AbstractComponent.js'; export class HistoryButtons extends AbstractComponent { - domElem() { + mount() { this._el.children.item(0).addEventListener('click', () => { this.props.movesTable.current = 0; this.props.movesTable.props.chessboard.setPosition( this.props.movesTable.props.fen[this.props.movesTable.current], true ); - this.props.movesTable.domElem(); + this.props.movesTable.mount(); }); this._el.children.item(1).addEventListener('click', () => { @@ -16,7 +16,7 @@ export class HistoryButtons extends AbstractComponent { this.props.movesTable.props.chessboard.setPosition( this.props.movesTable.props.fen[this.props.movesTable.current], true ); - this.props.movesTable.domElem(); + this.props.movesTable.mount(); } }); @@ -26,7 +26,7 @@ export class HistoryButtons extends AbstractComponent { this.props.movesTable.props.chessboard.setPosition( this.props.movesTable.props.fen[this.props.movesTable.current], true ); - this.props.movesTable.domElem(); + this.props.movesTable.mount(); } }); @@ -35,7 +35,7 @@ export class HistoryButtons extends AbstractComponent { this.props.movesTable.props.chessboard.setPosition( this.props.movesTable.props.fen[this.props.movesTable.current], true ); - this.props.movesTable.domElem(); + this.props.movesTable.mount(); }); } } diff --git a/src/OpeningTable.js b/src/OpeningTable.js index 592981c..12bed60 100644 --- a/src/OpeningTable.js +++ b/src/OpeningTable.js @@ -2,7 +2,7 @@ import { Opening } from '../src/common/Opening.js'; import AbstractComponent from '../src/AbstractComponent.js'; export class OpeningTable extends AbstractComponent { - domElem() { + mount() { const opening = Opening.byMovetext(this.props.movetext); this._el.replaceChildren(); if (opening) { diff --git a/src/RavMovesTable.js b/src/RavMovesTable.js index ae2e0fa..f01985a 100644 --- a/src/RavMovesTable.js +++ b/src/RavMovesTable.js @@ -65,7 +65,7 @@ export class RavMovesTable extends AbstractComponent { el.classList.add(ACTIVE_MOVE); } - domElem() { + mount() { this._el.replaceChildren(); const description = Movetext.description(this.props.breakdown[0]); diff --git a/src/SanMovesTable.js b/src/SanMovesTable.js index 531d965..791b92f 100644 --- a/src/SanMovesTable.js +++ b/src/SanMovesTable.js @@ -56,7 +56,7 @@ export class SanMovesTable extends AbstractComponent { } } - domElem() { + mount() { this._el.replaceChildren(); this._moves().forEach(move => { diff --git a/src/TimerTable.js b/src/TimerTable.js index 3c2c2d0..8b67dde 100644 --- a/src/TimerTable.js +++ b/src/TimerTable.js @@ -27,7 +27,7 @@ export class TimerTable extends AbstractComponent { return this; } - domElem() { + mount() { this._el.replaceChildren(); const tr = document.createElement('tr'); const wTd = document.createElement('td');