Skip to content

Instantly share code, notes, and snippets.

@blinkylights23
Last active July 10, 2020 10:28
Show Gist options
  • Save blinkylights23/d6970864c106fb5e31ae27441ae59d67 to your computer and use it in GitHub Desktop.
Save blinkylights23/d6970864c106fb5e31ae27441ae59d67 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'pub',
initial: 'unpublished',
context: {
arcId: null
},
states: {
unpublished: {
on: {
PUBLISH: {
target: 'published',
actions: ['notifyCMC_RL', 'notifyOutbound_RL']
},
UNPUBLISH: 'unpublished',
DELETE: {
target: 'deleted',
actions: ['notifyCMC_DL', 'notifyOutbound_DL']
}
},
meta: {
chosunStatus: 'WT'
}
},
published: {
on: {
PUBLISH: {
target: 'published',
actions: ['notifyCMC_RL', 'notifyOutbound_RL']
},
UNPUBLISH: {
target: 'unpublished',
actions: ['notifyCMC_WT', 'notifyOutbound_DL']
},
DELETE: {
target: 'deleted',
actions: ['notifyCMC_WT', 'notifyCMC_DL', 'notifyOutbound_DL']
}
},
meta: {
chosunStatus: 'RL'
}
},
deleted: {
type: 'final',
meta: {
chosunStatus: 'DL'
}
}
},
actions: {
notifyCMC_RL: (event, context) => {
console.log('Notifying CMC: RL')
},
notifyCMC_WT: (event, context) => {
console.log('Notifying CMC: WT')
},
notifyCMC_DL: (event, context) => {
console.log('Notifying CMC: DL')
},
notifyOutbound_RL: (event, context) => {
console.log('Notifying Outbound feeds: RL')
},
notifyOutbound_WT: (event, context) => {
console.log('Notifying Outbound feeds: WT')
},
notifyOutbound_DL: (event, context) => {
console.log('Notifying Outbound feeds: DL')
}
},
guards: {},
activities: {},
services: {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment