Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Available variables:
- // - Machine
- // - interpret
- // - assign
- // - send
- // - sendParent
- // - spawn
- // - raise
- // - actions
- // - XState (all XState exports)
- const fetchMachine = Machine({
- id: 'sortieOF',
- initial: 'of',
- context: {
- type: "GERE"
- },
- states: {
- of: {
- on: {
- NEXT: "centreEmplacement"
- }
- },
- centreEmplacement: {
- on: {
- NEXT: "boucle"
- }
- },
- boucle: {
- initial: "article",
- states: {
- article: {
- on: {
- NEXT: [
- { target: "lot", cond: "isLot" },
- { target: "serie", cond: "isSerie" },
- { target: "qte" }
- ]
- }
- },
- lot: {
- on: {
- NEXT: [
- { target: "serie", cond: "isLotSerie" },
- { target: "qte" }
- ]
- }
- },
- serie: {
- on: {
- NEXT: "qte"
- }
- },
- qte: {
- on: {
- NEXT: "article"
- }
- }
- },
- on: {
- EXIT: "recap"
- }
- },
- recap: {
- type: "final"
- }
- }
- }, {
- guards: {
- isLot: ctx => ctx.type === "LOT" || ctx.type === "LOTSERIE",
- isSerie: ctx => ctx.type === "SERIE",
- isLotSerie: ctx => ctx.type === "LOTSERIE",
- isGere: ctx => ctx.type === "GERE"
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement