Last active
May 21, 2021 20:00
-
-
Save fastestOrange/485c61671446d335ad03c5e79c7d744c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const whatMachine = Machine({ | |
id: 'whatDoIDo?', | |
initial: 'loading', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
loading: { | |
on: { | |
SUCCESS: "loaded", | |
FAILURE: "error" | |
} | |
}, | |
loaded: { | |
on: { | |
PUBLISHED: "published", | |
DRAFT: "draft" | |
} | |
}, | |
changes: { | |
on: { | |
// ACCEPT to which state should the state machine transaction to when this trigger is triggered. | |
// CLOSE to which state should the state machine transaction to when this trigger is triggered. | |
// RESET to which state should the state machine transaction to when this trigger is triggered. | |
} | |
}, | |
editing: { | |
on: { | |
CHANGES: "changes", | |
SAVE: "draft" | |
} | |
}, | |
draft: { | |
on: { | |
EDIT: "editing" | |
// WHAT OTHER TRIGGERS TO STATES GO HERE ?? | |
} | |
}, | |
published: { | |
on: { | |
EDIT: "editing", | |
DRAFT: "draft", | |
CHANGES: "changes" | |
} | |
}, | |
error: { | |
// How can the this retry if there's and error | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment