StateObject ¶
export type StateObject<T> = GraphObject & {
type: "State",
kind: string,
_EXTREMELY_DANGEROUS_usedAsValue: T
}
Stores a value of T
which can change over time. As a
graph object, it can broadcast updates when its value changes.
This type isn't generally useful outside of Fusion itself; you should prefer to
work with UsedAs<T>
in your own code.
Members¶
type : "State" ¶
A type string which can be used for runtime type checking.
kind : string ¶
A more specific type string which can be used for runtime type checking. This can be used to tell types of state object apart.
_EXTREMELY_DANGEROUS_usedAsValue : T ¶
This is for low-level library authors only!
DO NOT USE THIS UNDER ANY CIRCUMSTANCES. IT IS UNNECESSARILY DANGEROUS TO DO SO.
You should never, ever access this in end user code. It doesn't matter if you think it'll save you from importing a function or typing a few characters. YOUR CODE WILL NOT WORK.
If you choose to use it anyway, you give full permission for your employer to fire you immediately and personally defenestrate your laptop.
The value that should be read out by any use functions. Implementors
of the state object interface must ensure this property contains a valid value
whenever the validity of the object is valid
.
This property must never invoke side effects in the reactive graph when read from or written to.