The type of the return value of your function.
The function to execute without creating subscriptions.
Whatever func
returns.
const data = proxy({ a: 1, b: 2 });
observe(() => {
// re-executes only when data.a changes, because data.b is peeked.
const b = peek(() => data.b);
console.log(`A is ${data.a}, B was ${b} when A changed.`);
});
data.b = 3; // Does not trigger console.log
data.a = 2; // Triggers console.log (logs "A is 2, B was 3 when A changed.")
Executes a function without creating subscriptions in the current reactive scope, and returns its result.
This is useful when you need to access reactive data inside a reactive scope (like observe) but do not want changes to that specific data to trigger a re-execute of the scope.