@dice-roller/rpg-dice-roller / RollHistory
Class: RollHistory โ
Defined in: src/RollHistory.ts:9
A log of rolls.
Implements โ
Constructors โ
Constructor โ
new RollHistory():
RollHistory
Returns โ
RollHistory
Accessors โ
length โ
Get Signature โ
get length():
number
Defined in: src/RollHistory.ts:23
Number of rolls in the history.
Returns โ
number
rolls โ
Get Signature โ
Defined in: src/RollHistory.ts:13
A copy of the rolls, oldest first.
Returns โ
readonly Roll<unknown, DrawMode>[]
total โ
Get Signature โ
get total():
number
Defined in: src/RollHistory.ts:18
The sum of the roll totals, or 0 when empty (NaN if they include both Infinity and -Infinity).
Returns โ
number
Methods โ
[iterator]() โ
Defined in: src/RollHistory.ts:38
Iterates over a snapshot of the rolls, oldest first.
Returns โ
Iterator<Roll<unknown, DrawMode>>
Implementation of โ
Iterable.[iterator]
add() โ
add(...
rolls):void
Defined in: src/RollHistory.ts:28
Appends rolls in order.
Parameters โ
rolls โ
Returns โ
void
clear() โ
clear():
void
Defined in: src/RollHistory.ts:33
Removes all rolls from the history.
Returns โ
void
present() โ
present<
T>(presenter?):T
Defined in: src/RollHistory.ts:43
Presents the whole history; defaults to the default TextPresenter.
Type Parameters โ
T โ
T = string
Parameters โ
presenter? โ
Presenter<T>
Returns โ
T
toJSON() โ
toJSON():
object
Defined in: src/RollHistory.ts:55
JSON-safe export data with non-finite numbers tagged; evaluates uncached roll min/max totals.
Returns โ
rolls โ
readonlyrolls: readonlyobject[]
total โ
readonlytotal:EncodedNumber
Can be NaN, e.g. for a history of 1/0 and -1/0.
type โ
readonlytype:"history"
version โ
readonlyversion:1
toString() โ
toString():
string
Defined in: src/RollHistory.ts:50
Always the default TextPresenter output.
Returns โ
string