Home > @theatre/core > val

val() function

Takes a Pointer and returns the value it points to.

Signature:

export declare function val<T>(pointer: PointerType<T>): T;

Parameters

Parameter Type Description
pointer PointerType<T> A pointer (like object.props.x)

Returns:

T

The value the pointer points to

Example

Usage

import {val, getProject} from '@theatre/core'

const obj = getProject("A project").sheet("Scene").object("Box", {position: {x: 0}})

console.log(val(obj.props.position.x)) // logs the value of obj.props.x