ConanState

The class ConanState contains the following methods:

connectMap <PROPS>

this method allows connecting a Conan state with a React component, using a mapper function to describe the mapping

Input

toConnect

Type: React.ComponentType required

the component type we want to connect

mapper

Type: IBiFunction<DATA, ACTIONS, PROPS> required

A function that receives DATA and ACTIONS. It describes how the PROPS will be connected

Returns

ReactElement

A connected React element

connectData

this method allows connecting all Conan state data with a React component,

Input

toConnect

Type: React.ComponentType required

the component type we want to connect

Returns

ReactElement

A connected React element

connect

‌this method allows connecting all Conan state with a React component

Input

​Title

toConnect

Type: React.ComponentType<ConnectedState<DATA, ACTIONS>> required

the component type we want to connect

Returns

​Title

ReactElement<ConnectedState>

A React element with the whole ConnectedState

connectLive

‌this method allows producing connected react elements by accepting a renderer function, which receives the ConanState data and actions.

Input

​Title

renderer

Type: IBiFunction<DATA, ACTIONS, ReactElement | ReactElement[]> required

The render function that will produce out connected react elements

fallbackValue

Type: DATA optional

default DATA in case nothing is there when initialised

Returns

​Title

ReactElement

A State connected React element

addDataReaction

‌this method can be uses to add a custom data reaction a un ConanState

Input

​Title

def

Type: DataReactionDef<DATA> required

the custom data reaction definition

Returns

​Title

DataReactionLock

TBC: Alberto que coño es esto

do

‌this method returns the actions available for this ConanState

Input

​Title

void

Returns

​Title

DataReactionLock

actions available for this ConanState

getData

‌this method returns the current data of this ConanState

Input

​Title

void

Returns

​Title

DATA

current data of this ConanState

filter

‌this method returns a filtered ConanState

Input

​Title

mapper

Type: (current: DATA, previous: DATA) => boolean required

the filter function that receives the current and previous DATA and has to return a boolean

Returns

​Title

ConanState<DATA>

The resulting filtered ConanState

map<T>

‌this method returns a remapped ConanState

Input

​Title

mapper

Type: IFunction<DATA, T> required

the mapper function that receives the current DATA and has to return the new remmapped ConanState

Returns

​Title

ConanState<DATA>

The resulting remapped ConanState

merge<T, TO_MERGE>

‌this method returns a remapped ConanState

Input

​Title

toMerge$

Type: ConanState<TO_MERGE, any> required

the ConanState that we want to merge with

merger

Type: ITriFunction<DATA, TO_MERGE, T, T> required

the function that describes the merge operation

Returns

​Title

ConanState<T>

The resulting merged ConanState

tuple<TO_MERGE>

‌this method combined two states into one

Input

​Title

toMerge$

Type: ConanState<TO_MERGE, any> required

the ConanState that we want to merge with

Returns

​Title

ConanState<[DATA, TO_MERGE]>

The resulting combined ConanState

asyncState

‌this method gives access to the async state data and actions

Input

​Title

void

Returns

​Title

ConanState<MonitorInfo, MonitorActions>

the async state data and actions

metaFlow

‌‌this method gives access to the state meta flow

Input

​Title

void

Content

Returns

​Title

ConanFlow<MetaStatuses, MetaMutators>

the meta Conan flow for this state

combine<T extends {}, ACTIONS = void>

‌this method combined two states into one

Input

​Title

name

Type: String required

The name for the combined ConanState that will be returned

fromState

Type: {[KEY in keyof T]: ConanState<T[KEY], any>} required

the ConanState that we want to combine

pipeThreadDef

Type: PipeThreadDef<T, {}, ACTIONS> optional

TBC: Alberto que coño es esto

Returns

​Title

ConanState<T, ACTIONS>

The resulting combined ConanState

getEvents

‌this method gives access to the ConanState main thread events

Input

​Title

void

Returns

​Title

FlowEventsTracker<{ nextData: DATA}>

all the events that have gone through the state main thread

getName

‌this method returns the ConantState name

Input

​Title

void

Returns

​Title

string

the ConanState name

openTransaction

‌this method allows to open a transaction

Input

​Title

name

Type: String required

The name of the transaction to create to be used for internal logging only

Returns

​Title

void

closeTransaction

‌this method allows to close the current transaction

Input

​Title

callback

Type: IConsumer<DATA> optional

callback to be invoked once the transaction is closed

Returns

​Title

void

Last updated