NarabeElementOptionstype
Host state, rules, replay choices, drawing options and callbacks.
Import it
import type { NarabeElementOptions } from "@johnmorrisdotca/narabe/element";
Also exported from: @johnmorrisdotca/narabe/element/define
Definition
type NarabeElementOptions = {
state?: GameState;
settings?: Partial<GameSettings>;
moves?: readonly MoveInput[];
choices?: readonly OpeningChoice[];
clocked?: boolean;
draw?: DrawBoardOptions;
onChange?: (state: GameState) => void;
};
Members
| Name | Type | Description |
|---|---|---|
state (optional) | GameState | undefined | Complete host position, taking precedence over replay input. |
settings (optional) | Partial<GameSettings> | undefined | Advanced native engine settings; attributes override these. |
moves (optional) | readonly MoveInput[] | undefined | Trusted host moves, used when the moves attribute is absent. |
choices (optional) | readonly OpeningChoice[] | undefined | Native colour-opening decisions. |
clocked (optional) | boolean | undefined | Whether recorded clock forfeits may replay. |
draw (optional) | DrawBoardOptions | undefined | Native SVG drawing options. |
onChange (optional) | ((state: GameState) => void) | undefined | Called after a position changes, with the structured state. |
Examples
import type { NarabeElementOptions } from "@johnmorrisdotca/narabe/element";
const options: NarabeElementOptions = { settings: { variant: "freestyle" }, draw: { legal: true } };
console.log(options.settings?.variant);freestyleWhat it prints (run when this page was built)