module@warp-drive/experiments/storage @experimental
Function param()
ts
function param(config): PropertyDecorator;Defined in: storage/query-params.ts:112
Decorator which marks a field as a query parameter.
This decorator only stores metadata - it does not change the property behavior. The field will operate as a normal @field until a router integration consumes it.
The provided ParamConfig is used to:
- Serialize values for the URL
- Deserialize values from the URL
- Compare URL and local values
- Determine when to include/exclude params from the URL
Parameters
config
Configuration for URL serialization/deserialization
Returns
PropertyDecorator
Example
ts
@SessionResource('map-state')
class MapState {
@param({
serialize: (value: unknown) => (value ? '1' : null),
deserialize: (urlValue: string) => urlValue === '1',
})
@field
active: boolean = false;
}