2023-05-11 14:32:48 +00:00
|
|
|
import { GoBoard } from "./components/Board";
|
2023-05-11 13:39:31 +00:00
|
|
|
import { CoreApi, initCore } from "./coreApi";
|
2023-05-10 13:42:02 +00:00
|
|
|
|
2023-05-11 14:32:48 +00:00
|
|
|
window.customElements.define("go-board", GoBoard, { extends: "canvas" });
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface HTMLElementTagNameMap {
|
|
|
|
"go-board": GoBoard;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:42:02 +00:00
|
|
|
const main = async () => {
|
2023-05-11 13:39:31 +00:00
|
|
|
let coreApi = await initCore();
|
|
|
|
let response = await coreApi.playingField();
|
2023-05-10 13:42:02 +00:00
|
|
|
console.log("playing field response: ", response);
|
2023-05-11 14:32:48 +00:00
|
|
|
|
|
|
|
const root = document.getElementById("root");
|
|
|
|
if (!root) {
|
|
|
|
alert("could not retrieve the app root container");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const board = document.createElement("canvas", { is: "go-board" });
|
|
|
|
console.log("constructed board: ", board);
|
|
|
|
root.appendChild(board);
|
2023-05-10 13:42:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
main();
|