Open History to see the last commit
1export function ref<T>(initial: T) {
2 let value = $state(initial)
3β
4 return {
5 get value() {
6 return value
7 },
8 set value(newValue) {
9 value = newValue
10 },
11 }
12}
13β
14export const staleTime = ref(1000)
15export const gcTime = ref(3000)
16export const errorRate = ref(0.05)
17export const queryTimeMin = ref(1000)
18export const queryTimeMax = ref(2000)
19β
20export const editingIndex = ref<number | null>(null)
21export const views = ref(['', 'fruit', 'grape'])
22β
23let initialId = 0
24const initialList = [
25 'apple',
26 'banana',
27 'pineapple',
28 'grapefruit',
29 'dragonfruit',
30 'grapes',
31].map((d) => ({ id: initialId++, name: d, notes: 'These are some notes' }))
32β
33export const list = ref(initialList)
34export const id = ref(initialId)
35β
36export type Todos = typeof initialList
37export type Todo = Todos[0]