Skip to content

Profectus / features/resources/resource / createResource

Function: createResource() ​

Call Signature ​

createResource<T>(defaultValue, displayName?, precision?, small?): Resource<T> & Persistent<T> & object

Creates a resource.

Type Parameters ​

• T extends State

Parameters ​

defaultValue ​

T

The initial value of the resource

displayName? ​

string

The human readable name of this resource

precision? ​

number

The number of significant digits to display by default

small? ​

boolean

Whether or not to display very small values or round to 0, by default

Returns ​

Resource<T> & Persistent<T> & object

Defined in ​

profectus/src/features/resources/resource.ts:27

Call Signature ​

createResource<T>(defaultValue, displayName?, precision?, small?): Resource<T>

Creates a resource.

Type Parameters ​

• T extends State

Parameters ​

defaultValue ​

Ref<T, T>

The initial value of the resource

displayName? ​

string

The human readable name of this resource

precision? ​

number

The number of significant digits to display by default

small? ​

boolean

Whether or not to display very small values or round to 0, by default

Returns ​

Resource<T>

Defined in ​

profectus/src/features/resources/resource.ts:33