finity icon indicating copy to clipboard operation
finity copied to clipboard

Can I pass data to leave througth out all states?

Open LucasBadico opened this issue 7 years ago • 0 comments

const worker = Finity
  .configure()
    .initialState('ready')
      .on('task_submitted').transitionTo('running')
    .state('running')
    // here I have the context.eventPayload
    // but if I want to inside the worker gerate a data to use in another state?
      .do((state, context) => processTaskAsync(context.eventPayload))
        .onSuccess().transitionTo('succeeded')
        .onFailure().transitionTo('failed')
      .onTimeout(1000)
        .transitionTo('timed_out')
    .global()
      .onStateEnter(state => console.log(`Entering state '${state}'`))
  .start();

LucasBadico avatar Oct 01 '18 18:10 LucasBadico