Skip to content

Type Alias: RollerOptions ​

ts
type RollerOptions = object;

Defined in: src/ui/mount.ts:53

Everything a tray can be told when it is mounted. All of it is optional.

Properties ​

locale? ​

ts
optional locale?: string;

Defined in: src/ui/mount.ts:55

For numbers and times, and for which built-in words to use: "ja…" is Japanese, anything else English.


strings? ​

ts
optional strings?: Partial<RollerStrings>;

Defined in: src/ui/mount.ts:57

Words to use instead of the built-in ones.


storage? ​

ts
optional storage?: StorageLike | null;

Defined in: src/ui/mount.ts:59

Where the history is kept. Defaults to localStorage; pass null to keep nothing.


storageKey? ​

ts
optional storageKey?: string;

Defined in: src/ui/mount.ts:61

The key the history is kept under. Defaults to "korokoro.history".


spec? ​

ts
optional spec?: Partial<RollSpec>;

Defined in: src/ui/mount.ts:63

The dice showing when the tray opens.


query? ​

ts
optional query?: string;

Defined in: src/ui/mount.ts:65

A query string that may hold a shared roll or a seed. Defaults to the page's own.


shareBase? ​

ts
optional shareBase?: string;

Defined in: src/ui/mount.ts:67

The address a shared link points at. Defaults to the page's own, without its query.


cloth? ​

ts
optional cloth?: Cloth;

Defined in: src/ui/mount.ts:69

The cloth the felt is laid in: "green" (unless said), "blue", "red", "black" or "wood", the family's five. theme is laid over it.


onePip? ​

ts
optional onePip?: "red" | "black";

Defined in: src/ui/mount.ts:71

The colour of a d6's one pip, on the felt and in the history: "red" (unless said) or "black", the colour of the other pips.


theme? ​

ts
optional theme?: Record<`--kk-${string}`, string>;

Defined in: src/ui/mount.ts:73

CSS variables for the tray, such as { "--kk-felt": "#234" }: set on the tray itself, so they win over its defaults in both themes.


wide? ​

ts
optional wide?: boolean;

Defined in: src/ui/mount.ts:75

Tray and panels side by side on a wide screen.


onRoll? ​

ts
optional onRoll?: (roll) => void;

Defined in: src/ui/mount.ts:77

Called once each roll has landed.

Parameters ​

roll ​

Roll

Returns ​

void


animationMs? ​

ts
optional animationMs?: number;

Defined in: src/ui/mount.ts:79

Length of the tumble, in milliseconds, from the throw to the last die landing. Reduced motion always skips it.


sound? ​

ts
optional sound?: boolean;

Defined in: src/ui/mount.ts:85

Whether the tray has a sound at all. Left out or true, it has a mute button, and starts with the sound on unless the device asks for reduced motion or somebody muted it here before. False, it is silent and has no button.


playSound? ​

ts
optional playSound?: PlaySound;

Defined in: src/ui/mount.ts:87

A sound of your own for each throw, in place of the recorded dice. It is called only while the tray is not muted.


hold? ​

ts
optional hold?: boolean;

Defined in: src/ui/mount.ts:93

Whether a die on the felt can be tapped to hold it while the rest are rolled again. Left out or true, plain dice can be held once they have been rolled. False, a tap anywhere on the felt rolls, a die included.


placeholder? ​

ts
optional placeholder?: boolean;

Defined in: src/ui/mount.ts:101

Whether the dice the tray opens with are only a suggestion. Left out or true, they are: the first die button tapped replaces them with one of that die, so one tap gives a d20, and every tap after that adds. False, the opening dice are the user's own roll and the first tap adds to them. A roll that arrives by a shared link is always the user's.


keyboard? ​

ts
optional keyboard?: boolean;

Defined in: src/ui/mount.ts:108

Whether Space rolls from anywhere on the page. Left out or true, it does, unless something that takes typing has the focus. False, the page keeps its Space (to scroll, say) and the tray rolls from the keyboard only when the focus is inside it: for a tray that is one thing among many on a page.


languageChooser? ​

ts
optional languageChooser?: boolean;

Defined in: src/ui/mount.ts:110

Whether the tray offers its own small choice of language, English or 日本語, remembered on the device. Off unless asked for, so the tray stays as plain as it was.


size? ​

ts
optional size?: RollerSize;

Defined in: src/ui/mount.ts:118

How much of the tray is drawn, for a tray put into a small space on somebody's page. "small" is the felt and the result and nothing else: the dice are the ones it was given. "medium" adds the choice of dice and the bonus. "large", and left out, is everything: the history, the stats and the odds too.

MIT © John Morris