Thread
The class Thread has the following methods:
​

getData

this method returns the Thread's attached DATA
Returns
​
DATA
the date
​
​

start

this method starts the Thread
Returns
​
void
-
​
​

stop

this method stops the Thread
Input
​
eventsConsumer
Type: (events) => void required
a function that will receive all the events until the thread was stopped
Returns
​
void
​
​
​

next

this method will call the callback passed as param when the thread's state changes
Input
​
cb
Type: (onNext: Context<ThreadFlow<DATA>, 'nextData', { nextData: REDUCERS }>) required
the callback to invoke
Returns
​
void
​
​

addReaction

this method allows to add a reaction on the thread
Input
​
def
Type: DataReactionDef<DATA> required
the data reaction definition
Returns
​
DataReactionLock
TBC: Alberto quΓ© mierda es esto
​
​

chain

this method allows to chain a callback to the next data update
Input
​
mutatorsCb
Type: IConsumer<REDUCERS & DefaultStepFn<DATA>> required
the callback to chain
name
Type: string optional
the name passed will be eaten by the framework and ignored
Returns
​
Asap<DATA>
The up to date DATA of the Thread
​

monitor<T>

this method allows to perform async operations within a thread in a controlled way
Input
​
toMonitor
Type: Asap<T> required
the Asap we want to monitor
thenCallback
Type: IBiConsumer<T, REDUCERS & DefaultStepFn<T>> required
callback function to invoke when the Asap is resolved
payload
Type: any optional
payload used for logging
​
​
Returns
​
Asap<DATA>
The up to date DATA of the Thread
​

isRunning

true of the underlying flow is running
Returns
​
Boolean
-
​

reducers

returns the underlying flow reducers
Returns
​
REDUCERS & DefaultStepFn<DATA>
​
​

getEvents

returns the underlying flow events
Returns
​
FlowEventsTracker<{ nextData: DATA }>
​
​

getName

returns the underlying flow name
Returns
​
string
​
​

changeLoggingNature

gives access to changing the underlying flow logging nature
Input
​
nature
Type: FlowEventNature required
the new logging nature
Returns
​
void
-
​

log

logs a message
Input
​
msg
Type: string required
the message to log
Returns
​
void
​
​

once

adds a reaction once to the underlying flow
Input
​
reaction
Type: IConsumer<DATA> required
the reaction to add
name
Type: string optional
reaction name used for logging purposes
Returns
​
this
​
​
​
Last modified 1yr ago