Utilities

Utilities

Function Export Docs
formatValue(v, format) Named export from htmlgamekit below
GameShell.toBase64Url(buf) Static on GameShell GameShell
GameShell.fromBase64Url(str) Static on GameShell GameShell
GameShell.encodeUint16WithBitmask(scale?) Static on GameShell GameShell
GameShell.encodeUint16Array(scale?, roundCount?) Static on GameShell GameShell
gameScores(id, opts) Named export from htmlgamekit Scoring
noopScores Named export from htmlgamekit Scoring
groupParam() Named export from htmlgamekit GameShell
appendGroupParam(url) Named export from htmlgamekit GameShell

formatValue(v, format)

Formats a numeric game value for display.

import { formatValue } from "htmlgamekit";

Parameters:

Returns: string

formatValue(342.7, "ms"); // "343ms"
formatValue(0.123, "2dp"); // "0.12"
formatValue(42, "plain"); // "42"

Used by <game-stat>, <game-result-stat>, and <game-signal> via their format attribute.