#How to list events and their metadata

1 messages · Page 1 of 1 (latest)

elfin oriole
#

Hola!
I'm trying to list all the events I have defined on my state machine, including their metadata. I have tried to use machine.events as posted here #1021320975846998036 message but it only returns an array of strings with event types.

Any way to obtain the metadata of these events?

Thanks!

nimble marlin
#

What kind of metadata do you have? Do you want type information?

#

The type information is not available at runtime

elfin oriole
#

I was more thinking of the meta property, e.g.


            ACCEPT: {
              cond: 'isWorker',
              actions: 'assignWorker',
              meta: { hey: true },
              target: 'PROCESS_PAYMENT',
            },
nimble marlin
#

Ah okay, so you want the transition objects then

#

For an individual state (the machine itself is a root state), that's under state.transitions

elfin oriole
#

state.transitions's documentation says "The transition definitions that resulted in this state.", however I'd like to see all transition definitions (my bad for using the wrong word, apologies!) and not the one that resulted in this state, if that makes sense?

nimble marlin
#

Yeah sorry for the confusion, I meant stateNode.transitions. For example:

const stateNode = machine.getStateNodeById('loading');

stateNode.transitions;