TanePickerOptionstype
Host data, a native random stream, optional weights and a result callback.
Import it
import type { TanePickerOptions } from "@johnmorrisdotca/tane/element";
Also exported from: @johnmorrisdotca/tane/element/define
Definition
type TanePickerOptions = {
items?: readonly string[];
seed?: string | number;
random?: Random;
weights?: readonly number[];
onPick?: (detail: TanePickDetail) => void;
};
Members
| Name | Type | Description |
|---|---|---|
items (optional) | readonly string[] | undefined | Host items when the items attribute is absent. |
seed (optional) | string | number | undefined | Host seed when the seed attribute is absent; daily takes priority. |
random (optional) | Random | undefined | A host stream when no seed or daily attribute is supplied. |
weights (optional) | readonly number[] | undefined | Nonnegative weights for picking; shuffles and groups remain uniform. |
onPick (optional) | ((detail: TanePickDetail) => void) | undefined | Called with the same index-only detail as the native event. |
Examples
import type { TanePickerOptions } from "@johnmorrisdotca/tane/element";
const options: TanePickerOptions = { items: ["A", "B"], seed: 42 };
console.log(options.items?.length);2What it prints (run when this page was built)