FailureStatResult
Description
A FailureStatResult
is an interface that exposes the result of a failure of a stat calculation.
Properties
Property |
Type |
Description |
---|---|---|
success |
boolean |
false to indicate that the stat calculation failed. |
textKey? |
string |
A text key from the |
Example
A StatConfiguration
is using a custom viewer to display the stat result. When the context contains a FailureStatResult
, the error message is retrieved with the context.getText
function, with the textKey
of the error message.
class MyViewerProvider
{
constructor()
{
// The text span.
this.statSpan = document.createElement("span");
this.htmlElement = document.createElement("div");
this.htmlElement.appendChild(this.statSpan);
}
update(context)
{
// Update the text.
if (this.statSpan !== undefined)
{
let value = context.value.success ? context.value.value : context.getText(context.value.textKey);
this.statSpan.textContent = value;
}
}
}
Need help? Contact us!