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

stores.svelte.ts

37 lines806 Bytes

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 }
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]