Function StateEffectFactory
- StateEffectFactory(parent?): {
effect: {
state: {
UnsubscribedError: typeof UnsubscribedError;
create: (<Data, Modifiers>(initialValue, modifiers) => StateAtom<Data, Modifiers>);
dispatch: (<Modifier>(modifier, ...payload) => void);
subscribe: (<Ctx, Atom, A>(context, atom, task, errorCallback?) => Unsubscribe);
};
};
removeEffect?: (() => void);
}
-
Returns {
effect: {
state: {
UnsubscribedError: typeof UnsubscribedError;
create: (<Data, Modifiers>(initialValue, modifiers) => StateAtom<Data, Modifiers>);
dispatch: (<Modifier>(modifier, ...payload) => void);
subscribe: (<Ctx, Atom, A>(context, atom, task, errorCallback?) => Unsubscribe);
};
};
removeEffect?: (() => void);
}
-
effect: {
state: {
UnsubscribedError: typeof UnsubscribedError;
create: (<Data, Modifiers>(initialValue, modifiers) => StateAtom<Data, Modifiers>);
dispatch: (<Modifier>(modifier, ...payload) => void);
subscribe: (<Ctx, Atom, A>(context, atom, task, errorCallback?) => Unsubscribe);
};
}
-
state: {
UnsubscribedError: typeof UnsubscribedError;
create: (<Data, Modifiers>(initialValue, modifiers) => StateAtom<Data, Modifiers>);
dispatch: (<Modifier>(modifier, ...payload) => void);
subscribe: (<Ctx, Atom, A>(context, atom, task, errorCallback?) => Unsubscribe);
}
-
UnsubscribedError: typeof UnsubscribedError
-
create: (<Data, Modifiers>(initialValue, modifiers) => StateAtom<Data, Modifiers>)
-
- <Data, Modifiers>(initialValue, modifiers): StateAtom<Data, Modifiers>
-
Type Parameters
-
-
Modifiers extends {
[modifierName: string]: ((data, ...payload) => boolean);
}
Parameters
-
initialValue: Data
-
modifiers: Modifiers
Returns StateAtom<Data, Modifiers>
-
dispatch: (<Modifier>(modifier, ...payload) => void)
-
- <Modifier>(modifier, ...payload): void
-
Type Parameters
-
Modifier extends ((...parameters) => boolean) & {
[ModifierIdentifier]: StateAtom;
}
Parameters
-
modifier: Modifier
-
Rest
...payload: Parameters<Modifier>
Returns void
-
subscribe: (<Ctx, Atom, A>(context, atom, task, errorCallback?) => Unsubscribe)
-
- <Ctx, Atom, A>(context, atom, task, errorCallback?): Unsubscribe
-
-
Optional
removeEffect?: (() => void)