Skip to content
module@warp-drive/experiments/storage @experimental

Function NumberParam() ​

ts
function NumberParam(precision?: number, getDefault?: (instance: any) => number | undefined): ParamConfig;

Defined in: warp-drive-packages/experiments/src/storage/query-params.ts:72

Creates a ParamConfig for numeric fields with default value checking.

Parameters ​

precision? ​

number

When given, the number of digits to serialize after the decimal point

getDefault? ​

(instance: any) => number | undefined

Function to get the default value for comparison

Returns ​

ParamConfig

ParamConfig for number fields

Example ​

ts
@param(NumberParam(2, function (instance: MyClass) { return instance.defaultZoom; }))
@field
zoom: number = 12;

Released under the MIT License.