21 lines
496 B
JavaScript
21 lines
496 B
JavaScript
import { useStore } from 'stores/hooks';
|
|
|
|
export function useValue(valueName) {
|
|
const { $calculation } = useStore();
|
|
|
|
const storeValue = $calculation.$values.getValue(valueName);
|
|
|
|
function setStoreValue(value) {
|
|
$calculation.$values.setValue(valueName, value);
|
|
}
|
|
|
|
return [storeValue, setStoreValue];
|
|
}
|
|
|
|
export function useComputedValue(valueName) {
|
|
const { $calculation } = useStore();
|
|
const computedValue = $calculation.$values.$computed[valueName];
|
|
|
|
return computedValue;
|
|
}
|