mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-23 00:04:06 +00:00
[Docs] Fix example in doc comment (#2804)
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
* Does not observe deep changes.
|
||||
*
|
||||
* @example
|
||||
* const { get, set } = useValueTransform<ResultItem[], string[]>(
|
||||
* items => items.map(formatPath)
|
||||
* )
|
||||
*
|
||||
* const transformFunction = (items: string[]) => items.map(item => `root/${item}.ext`)
|
||||
* const { get, set } = useValueTransform(transformFunction, [])
|
||||
* Object.defineProperty(obj, 'value', { get, set })
|
||||
*
|
||||
* obj.value = ['filename1', 'filename2']
|
||||
* console.log(obj.value) // ["root/filename1.ext", "root/filename2.ext"]
|
||||
*/
|
||||
export function useValueTransform<Internal, External>(
|
||||
transform: (value: Internal) => External,
|
||||
|
||||
Reference in New Issue
Block a user