본문으로 건너뛰기

인터페이스: SolidThrottler<TFn, TSelected>

정의 위치: solid-pacer/src/throttler/createThrottler.ts:24

확장

  • Omit<Throttler<TFn>, "store">

타입 매개변수

TFn

TFn extends AnyFunction

TSelected

TSelected = { }

속성

state

readonly state: Accessor<Readonly<TSelected>>;

정의 위치: solid-pacer/src/throttler/createThrottler.ts:50

스로틀러 상태가 변경될 때 업데이트되는 반응형 상태입니다.

throttler.store.state 대신 이것을 사용합니다.


store

readonly store: Store<Readonly<ThrottlerState<TFn>>>;

정의 위치: solid-pacer/src/throttler/createThrottler.ts:56

지원 중단 예정

throttler.state를 사용해 반응형 상태를 읽고 throttler.store.state는 사용하지 않습니다. 스토어 객체의 상태는 내부에서 useSelector 훅으로 래핑되지 않았으므로 반응형이 아닙니다. 다만 직접 사용할 때 useSelector를 적용하면 상태를 반응형으로 만들 수 있습니다.


Subscribe()

Subscribe: <TSelected>(props) => Element;

정의 위치: solid-pacer/src/throttler/createThrottler.ts:41

스로틀러 상태를 구독할 수 있는 Solid 컴포넌트입니다.

스로틀러 상태의 특정 부분을 추적할 때 유용하며, 훅에 셀렉터를 전달하지 않고도 컴포넌트 트리 깊은 곳에서 사용할 수 있습니다.

타입 매개변수

TSelected

TSelected

매개변수

props
children

Element | (state) => Element

selector

(state) => TSelected

반환값

Element

예시

<throttler.Subscribe selector={(state) => ({ isPending: state.isPending })}>
{(state) => (
<div>{state().isPending ? 'Loading...' : 'Ready'}</div>
)}
</throttler.Subscribe>