DepSafe
type DepSafe = null | boolean | number | bigint | string | symbol | Managed;
A DepSafe
value is dependency-safe and can be used safely in reactive computations.
A value can be safely used as a dependency of a reactive computation if it is:
- a primitive JavaScript value (boolean, number, string, etc.)
- managed by the Skip runtime, which will correctly track dependencies, or
- a deep-frozen and therefore constant JavaScript object.
Values used in reactive computations must be dependency-safe so that reactive computations can be reevaluated as needed with consistent semantics.
All objects/values that come out of the Skip runtime are dependency-safe.
Non-Skip objects can be made dependency-safe by passing them to deepFreeze
, which recursively freezes their fields and returns a constant Managed
object.