computeSpm
computeSpm(
strokeCount,durationSeconds):number
Defined in: console-sdk/src/units/index.ts:399
Strokes-per-minute from a stroke count and duration, replicating the
firmware’s decisecond truncation: the console stores duration in 0.1s
units and divides by 10 with integer division, so 4.3s becomes 4s before
the rate is computed. A truncated duration under one second yields 0 (the
console shows no rate yet).
Parameters
Section titled “Parameters”strokeCount
Section titled “strokeCount”number
Total strokes in the window.
durationSeconds
Section titled “durationSeconds”number
Elapsed time in seconds (truncated internally).
Returns
Section titled “Returns”number
Strokes per minute (rounded), or 0 when undefined.
Example
Section titled “Example”computeSpm(4, 4.3); // 60 (floor(4.3)=4 → round(240/4))