Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

utils.svelte.ts

14 lines233 Bytes

1type Box<T> = { current: T }
2​
3export function box<T>(initial: T): Box<T> {
4 let current = $state(initial)
5​
6 return {
7 get current() {
8 return current
9 },
10 set current(newValue) {
11 current = newValue
12 },
13 }