Created
May 6, 2021 09:02
-
-
Save tricinel/b341879eaf4254ec504c5ecacf2e35d9 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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 loadImageMachine = Machine({ | |
id: 'loadImage', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
'no-store': 'GET', | |
'immutable': 'check-cache', | |
'stale-while-invalidate': 'force-update' | |
} | |
}, | |
GET: { | |
on: { | |
CACHE: 'cache', | |
NOCACHE: 'image' | |
} | |
}, | |
'check-cache': { | |
on: { | |
NOT_FOUND: 'GET', | |
FOUND: 'image' | |
} | |
}, | |
'force-update': { | |
on: { | |
YES: 'GET', | |
NO: 'cache' | |
} | |
}, | |
cache: { | |
on: { | |
'': 'image' | |
} | |
}, | |
image: { | |
type: 'final' | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment