Reference · Browser table and SVG
TenkaTableHandletype
Native game access, restoration, redealing and presentation updates.
Import it
import type { TenkaTableHandle } from "@johnmorrisdotca/tenka/ui";
Definition
type TenkaTableHandle = {
game: () => TenkaGame;
newGame: (options?: Pick<TenkaTableOptions, "players" | "computers" | "rounds" | "seed" | "map">) => void;
setGame: (game: TenkaGame, computers?: readonly boolean[]) => void;
setLocale: (locale: TenkaLocale, strings?: Partial<TenkaStrings>) => void;
set: (options: Pick<TenkaTableOptions, "locale" | "strings" | "theme" | "record" | "dressing" | "colours" | "computerDelayMs" | "onChange">) => void;
destroy: () => void;
};
Members
| Name | Type | Description |
|---|---|---|
game | () => TenkaGame | The game as it stands. |
newGame | (options?: Pick<TenkaTableOptions, "players" | "computers" | "rounds" | "seed" | "map">) => void | A new game at the same table, with any options changed. |
setGame | (game: TenkaGame, computers?: readonly boolean[]) => void | Put a game on the table: one read back by |
setLocale | (locale: TenkaLocale, strings?: Partial<TenkaStrings>) => void | Change the table's language, and with it any words of your own. |
set | (options: Pick<TenkaTableOptions, "locale" | "strings" | "theme" | "record" | "dressing" | "colours" | "computerDelayMs" | "onChange">) => void | Update presentation and callbacks without redealing or replacing the current game. |
destroy | () => void | Take the table off the page and stop its timers. |
Examples
import type { TenkaTableHandle } from "@johnmorrisdotca/tenka/ui";
const update = (table: TenkaTableHandle) => table.set({ locale: "ja" });
console.log(typeof update);functionWhat it prints (run when this page was built)