Reference
Playable board
import { … } from "@johnmorrisdotca/sugoroku/play";
20.3 kB minified and gzipped, with everything it imports (measured with esbuild)
Sugoroku, played in a page: mountSugoroku draws a game into any element and
plays it by touch and mouse, with the doubling cube, Undo, the computer for
either side or both, optional sounds, and the words in English and Japanese. A
separate entry (@johnmorrisdotca/sugoroku/play), so a server never loads any of it.
Exports
| Name | Kind | What it is |
|---|---|---|
createSounds | function | A player for the sounds, which makes its audio only when first asked to play, as browsers insist on a gesture first. |
ensureSugorokuPlayStyle | function | Put the style in the page once: in the document's head, or in the shadow root the host is in. |
mountSugoroku | function | Mount a board into host. |
packagedSounds | function | The sounds' addresses beside the package's code, or an empty set where import.meta.url is not an address (some test runners). |
SoundName | type | THE SOUNDS OF A BOARD, optional: a checker set down, a checker hit, the dice and the cube. |
SoundPlayer | type | Optional board-sound playback and cleanup methods. |
SoundUrls | type | The address of each sound. |
SUGOROKU_PLAY_STYLE | constant | THE STYLE a playable Sugoroku board wears (mountSugoroku, <sugoroku-board>): the drawing's own (SUGOROKU_STYLE), the board's box, its buttons and its lines of words. |
SUGOROKU_STRINGS | constant | The native English and Japanese labels, announcements and interpolation templates. |
SugorokuEventDetail | type | What every event of the board carries. |
SugorokuLanguage | type | THE WORDS A SUGOROKU BOARD SAYS, in English and Japanese: the buttons, the line that says whose turn it is and what to do, and the result of a game. |
sugorokuLanguageOf | function | The language an element or its page is in: its own lang, or the nearest above, and English unless that begins with ja. |
SugorokuLook | type | How the board looks, apart from the game. |
SugorokuMount | type | The mounted native board, current game/match/record, actions and cleanup handle. |
SugorokuMountOptions | type | Native variant, rules, seed, computer, display, control, sound and event-callback choices. |
sugorokuSay | function | A line in a language with its {name}s filled in. |