Skip to content

createGenericProjection

createProjection 的通用版本。接受自定义投影仪函数来映射任意类型的域。

¥Generic version of createProjection. Accepts a custom projector function to map arbitrary type of domains.

参见 createProjectionuseProjection

¥Refer to createProjection and useProjection

类型声明

ts
export type 
ProjectorFunction
<
F
,
T
> = (
input
:
F
,
from
: readonly [
F
,
F
],
to
: readonly [
T
,
T
],
) =>
T
export type
UseProjection
<
F
,
T
> = (
input
:
MaybeRefOrGetter
<
F
>) =>
ComputedRef
<
T
>
export declare function
createGenericProjection
<
F
= number,
T
= number>(
fromDomain
:
MaybeRefOrGetter
<readonly [
F
,
F
]>,
toDomain
:
MaybeRefOrGetter
<readonly [
T
,
T
]>,
projector
:
ProjectorFunction
<
F
,
T
>,
):
UseProjection
<
F
,
T
>

源代码

源代码文档

变更日志

d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)