|
390 | 390 | }
|
391 | 391 | ],
|
392 | 392 | "kind": "Function",
|
393 |
| - "content": "Create a computed signal which is calculated from the given QRL. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated.\n\nThe QRL must be a function which returns the value of the signal. The function must not have side effects, and it mus be synchronous.\n\nIf you need the function to be async, use `useSignal` and `useTask$` instead.\n\n\n```typescript\ncreateComputed$: <T>(qrl: () => T) => T extends Promise<any> ? never : ComputedSignal<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\n() => T\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT extends Promise<any> ? never : [ComputedSignal](#computedsignal)<!-- --><T>", |
| 393 | + "content": "Create a computed signal which is calculated from the given QRL. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated.\n\nThe QRL must be a function which returns the value of the signal. The function must not have side effects, and it must be synchronous.\n\nIf you need the function to be async, use `useSignal` and `useTask$` instead.\n\n\n```typescript\ncreateComputed$: <T>(qrl: () => T) => T extends Promise<any> ? never : ComputedSignal<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\n() => T\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT extends Promise<any> ? never : [ComputedSignal](#computedsignal)<!-- --><T>", |
394 | 394 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/signal/signal.public.ts",
|
395 | 395 | "mdFile": "core.createcomputed_.md"
|
396 | 396 | },
|
|
408 | 408 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-context.ts",
|
409 | 409 | "mdFile": "core.createcontextid.md"
|
410 | 410 | },
|
| 411 | + { |
| 412 | + "name": "createSerializer$", |
| 413 | + "id": "createserializer_", |
| 414 | + "hierarchy": [ |
| 415 | + { |
| 416 | + "name": "createSerializer$", |
| 417 | + "id": "createserializer_" |
| 418 | + } |
| 419 | + ], |
| 420 | + "kind": "Function", |
| 421 | + "content": "Create a signal that holds a custom serializable value. See [useSerializer$](#useserializer_) for more details.\n\n\n```typescript\ncreateSerializer$: <T, S>(arg: SerializerArg<T, S>) => T extends Promise<any> ? never : SerializerSignal<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\narg\n\n\n</td><td>\n\nSerializerArg<T, S>\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT extends Promise<any> ? never : SerializerSignal<T>", |
| 422 | + "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/signal/signal.public.ts", |
| 423 | + "mdFile": "core.createserializer_.md" |
| 424 | + }, |
411 | 425 | {
|
412 | 426 | "name": "createSignal",
|
413 | 427 | "id": "createsignal",
|
|
716 | 730 | }
|
717 | 731 | ],
|
718 | 732 | "kind": "Function",
|
719 |
| - "content": "```typescript\nisSignal: (value: any) => value is ISignal<unknown>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nvalue\n\n\n</td><td>\n\nany\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nvalue is [ISignal](#signal)<!-- --><unknown>", |
| 733 | + "content": "```typescript\nisSignal: (value: any) => value is Signal<unknown>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nvalue\n\n\n</td><td>\n\nany\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nvalue is [Signal](#signal)<!-- --><unknown>", |
720 | 734 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/signal/signal.ts",
|
721 | 735 | "mdFile": "core.issignal.md"
|
722 | 736 | },
|
|
1014 | 1028 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/utils/serialize-utils.ts",
|
1015 | 1029 | "mdFile": "core.noserialize.md"
|
1016 | 1030 | },
|
| 1031 | + { |
| 1032 | + "name": "NoSerializeSymbol", |
| 1033 | + "id": "noserializesymbol", |
| 1034 | + "hierarchy": [ |
| 1035 | + { |
| 1036 | + "name": "NoSerializeSymbol", |
| 1037 | + "id": "noserializesymbol" |
| 1038 | + } |
| 1039 | + ], |
| 1040 | + "kind": "Variable", |
| 1041 | + "content": "If an object has this property, it will not be serialized. Use this on prototypes to avoid having to call `noSerialize()` on every object.\n\n\n```typescript\nNoSerializeSymbol: unique symbol\n```", |
| 1042 | + "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/utils/serialize-utils.ts", |
| 1043 | + "mdFile": "core.noserializesymbol.md" |
| 1044 | + }, |
1017 | 1045 | {
|
1018 | 1046 | "name": "OnRenderFn",
|
1019 | 1047 | "id": "onrenderfn",
|
|
1714 | 1742 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts",
|
1715 | 1743 | "mdFile": "core.resourcereturn.md"
|
1716 | 1744 | },
|
| 1745 | + { |
| 1746 | + "name": "SerializerSymbol", |
| 1747 | + "id": "serializersymbol", |
| 1748 | + "hierarchy": [ |
| 1749 | + { |
| 1750 | + "name": "SerializerSymbol", |
| 1751 | + "id": "serializersymbol" |
| 1752 | + } |
| 1753 | + ], |
| 1754 | + "kind": "Variable", |
| 1755 | + "content": "If an object has this property as a function, it will be called with the object and should return a serializable value.\n\nThis can be used to clean up, integrate with other libraries, etc.\n\nThe type your object should conform to is:\n\n```ts\n{\n [SerializerSymbol]: (this: YourType, toSerialize: YourType) => YourSerializableType;\n}\n```\n\n\n```typescript\nSerializerSymbol: unique symbol\n```", |
| 1756 | + "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/utils/serialize-utils.ts", |
| 1757 | + "mdFile": "core.serializersymbol.md" |
| 1758 | + }, |
1717 | 1759 | {
|
1718 | 1760 | "name": "setPlatform",
|
1719 | 1761 | "id": "setplatform",
|
|
2060 | 2102 | }
|
2061 | 2103 | ],
|
2062 | 2104 | "kind": "Function",
|
2063 |
| - "content": "Creates a computed signal which is calculated from the given function. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.\n\nThe function must be synchronous and must not have any side effects.\n\n\n```typescript\nuseComputed$: <T>(qrl: import(\"./use-computed\").ComputedFn<T>) => T extends Promise<any> ? never : import(\"..\").ReadonlySignal<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\nimport(\"./use-computed\").[ComputedFn](#computedfn)<!-- --><T>\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT extends Promise<any> ? never : import(\"..\").[ReadonlySignal](#readonlysignal)<!-- --><T>", |
2064 |
| - "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed-dollar.ts", |
| 2105 | + "content": "Creates a computed signal which is calculated from the given function. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.\n\nThe function must be synchronous and must not have any side effects.\n\n\n```typescript\nuseComputed$: <T>(qrl: ComputedFn<T>) => T extends Promise<any> ? never : ReadonlySignal<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\n[ComputedFn](#computedfn)<!-- --><T>\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT extends Promise<any> ? never : [ReadonlySignal](#readonlysignal)<!-- --><T>", |
| 2106 | + "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts", |
2065 | 2107 | "mdFile": "core.usecomputed_.md"
|
2066 | 2108 | },
|
2067 | 2109 | {
|
|
2190 | 2232 | "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource-dollar.ts",
|
2191 | 2233 | "mdFile": "core.useresource_.md"
|
2192 | 2234 | },
|
| 2235 | + { |
| 2236 | + "name": "useSerializer$", |
| 2237 | + "id": "useserializer_", |
| 2238 | + "hierarchy": [ |
| 2239 | + { |
| 2240 | + "name": "useSerializer$", |
| 2241 | + "id": "useserializer_" |
| 2242 | + } |
| 2243 | + ], |
| 2244 | + "kind": "Variable", |
| 2245 | + "content": "Creates a signal which holds a custom serializable value. It requires that the value implements the `CustomSerializable` type, which means having a function under the `[SerializeSymbol]` property that returns a serializable value when called.\n\nThe `fn` you pass is called with the result of the serialization (in the browser, only when the value is needed), or `undefined` when not yet initialized. If you refer to other signals, `fn` will be called when those change just like computed signals, and then the argument will be the previous output, not the serialized result.\n\nThis is useful when using third party libraries that use custom objects that are not serializable.\n\nNote that the `fn` is called lazily, so it won't impact container resume.\n\n\n```typescript\nuseSerializer$: typeof createSerializer$\n```\n\n\n\n```tsx\nclass MyCustomSerializable {\n constructor(public n: number) {}\n inc() {\n this.n++;\n }\n}\nconst Cmp = component$(() => {\n const custom = useSerializer$({\n deserialize: (data) => new MyCustomSerializable(data),\n serialize: (data) => data.n,\n initial: 2,\n });\n return <div onClick$={() => custom.value.inc()}>{custom.value.n}</div>;\n});\n```\n\n\nWhen using a Signal as the data to create the object, you need to pass the configuration as a function, and you can then also provide the `update` function to update the object when the signal changes.\n\nBy returning an object from `update`<!-- -->, you signal that the listeners have to be notified. You can mutate the current object but you should return it so that it will trigger listeners.\n\n```tsx\nconst Cmp = component$(() => {\n const n = useSignal(2);\n const custom = useSerializer$(() =>\n ({\n deserialize: () => new MyCustomSerializable(n.value),\n update: (current) => {\n current.n = n.value;\n return current;\n }\n })\n );\n return <div onClick$={() => n.value++}>{custom.value.n}</div>;\n});\n```", |
| 2246 | + "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-serializer.ts", |
| 2247 | + "mdFile": "core.useserializer_.md" |
| 2248 | + }, |
2193 | 2249 | {
|
2194 | 2250 | "name": "useServerData",
|
2195 | 2251 | "id": "useserverdata",
|
|
0 commit comments