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

createChangeProxy.md

62 lines869 Bytes

1---
2id: createChangeProxy
3title: createChangeProxy
4---
5​
6# Function: createChangeProxy()
7​
8```ts
9function createChangeProxy<T>(target, parent?): object;
10```
11​
12Defined in: [packages/db/src/proxy.ts:628](https://github.com/TanStack/db/blob/main/packages/db/src/proxy.ts#L628)
13​
14Creates a proxy that tracks changes to the target object
15​
16## Type Parameters
17​
18### T
19​
20`T` *extends* `Record`\<`string` \| `symbol`, `any`\>
21​
22## Parameters
23​
24### target
25​
26`T`
27​
28The object to proxy
29​
30### parent?
31​
32Optional parent information
33​
34#### prop
35​
36`string` \| `symbol`
37​
38#### tracker
39​
40`ChangeTracker`\<`Record`\<`string` \| `symbol`, `unknown`\>\>
41​
42## Returns
43​
44`object`
45​
46An object containing the proxy and a function to get the changes
47​
48### getChanges()
49​
50```ts
51getChanges: () => Record<string | symbol, any>;
52```
53​
54#### Returns
55​
56`Record`\<`string` \| `symbol`, `any`\>
57​
58### proxy
59​
60```ts
61proxy: T;
62```