TanePickerOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Host data, a native random stream, optional weights and a result callback.
インポート
import type { TanePickerOptions } from "@johnmorrisdotca/tane/element";
ほかのエクスポート元: @johnmorrisdotca/tane/element/define
定義
type TanePickerOptions = {
items?: readonly string[];
seed?: string | number;
random?: Random;
weights?: readonly number[];
onPick?: (detail: TanePickDetail) => void;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
items (省略可) | readonly string[] | undefined | Host items when the items attribute is absent. |
seed (省略可) | string | number | undefined | Host seed when the seed attribute is absent; daily takes priority. |
random (省略可) | Random | undefined | A host stream when no seed or daily attribute is supplied. |
weights (省略可) | readonly number[] | undefined | Nonnegative weights for picking; shuffles and groups remain uniform. |
onPick (省略可) | ((detail: TanePickDetail) => void) | undefined | Called with the same index-only detail as the native event. |
例
import type { TanePickerOptions } from "@johnmorrisdotca/tane/element";
const options: TanePickerOptions = { items: ["A", "B"], seed: 42 };
console.log(options.items?.length);2出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。