本文へ移動

Korokoroコロコロ

ダイスを組み合わせて振り、ダイス表記を読み取り、正確な確率を調べます。履歴の保存やシードを指定した再現もできます。

「コロコロ」は、小さなものが転がる様子を表す言葉です。 名前について(英語)

目次

リファレンス

タグの自動登録

import { … } from "@johnmorrisdotca/korokoro/element/define";

最小化と gzip 圧縮をしたサイズは 97.2 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The custom element, registered by being imported:

<script type="module" src="…/dist/element-define.js"></script>

<korokoro-roller notation="2d20kh1+5"></korokoro-roller> <korokoro-die sides="20"></korokoro-die>

This is the one module of the package that does something when it is imported, and package.json says so, so that a bundler keeps it. ./element exports the same class and defineRoller() with no effect of its own, for a page that wants to choose when, or under what tag.

エクスポート

名前種類概要
defineDie関数Register <korokoro-die>, as that tag unless another is asked for.
defineRoller関数Register the element, as <korokoro-roller> unless another tag is asked for.
DIE_TAG定数The die's tag, unless another is asked for.
KorokoroDieクラスONE DIE ON ITS OWN, as a custom element:
KorokoroRollerクラスThe <korokoro-roller> element.
ROLLER_TAG定数The element's tag, unless another is asked for.

ソースを見るGitHub で編集@johnmorrisdotca/korokoro 1.16.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。