Skip to content

Instantly share code, notes, and snippets.

@pke
Created April 1, 2021 00:15
Show Gist options
  • Save pke/15b7ce280823feec9a973b9165f2f6b6 to your computer and use it in GitHub Desktop.
Save pke/15b7ce280823feec9a973b9165f2f6b6 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const resolveThumbnailUUID = objectUUID => "652a83a0-1463-4d67-b9e2-474b32488c37"
const fetchMachine = Machine({
id: 'thumbnails',
initial: 'loading',
context: {
objectUUID: "652a83a0-1463-4d67-b9e2-474b32488c37",
retries: 0
},
states: {
loading: {
on: {
FOUND: 'found',
NOTFOUND: 'create'
}
},
found: {
type: 'final'
},
create: {
on: {
GENERATED: {
target: 'upload'
}
}
},
upload: {
on: {
SUCCESS: "found"
}
}
}
}, {
actions: {
resolveThumbnailUUID,
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment