Last active
May 17, 2022 06:34
-
-
Save leesei/8f55aa571715dbd4512cf4221b25ce8d to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const OfflineModeMachine = Machine({ | |
initial: 'paused', | |
context: { | |
scale: 1 | |
}, | |
states: { | |
paused: { | |
on: { | |
PLAYPAUSE: 'playing', | |
SEEK: 'paused', | |
GALLERY_SEEK: 'gallery', | |
NEXT_FRAME: 'paused', | |
PREV_FRAME: 'paused', | |
FF: 'fffb', | |
FB: 'fffb', | |
} | |
}, | |
gallery: { | |
// `gallery` is mostly equivalent to `paused` | |
// but with different UI behavior | |
on: { | |
PLAYPAUSE: 'playing', | |
SEEK: 'paused', | |
GALLERY_SEEK: 'gallery', | |
NEXT_FRAME: 'paused', | |
PREV_FRAME: 'paused', | |
FF: 'fffb', | |
FB: 'fffb' | |
} | |
}, | |
playing: { | |
on: { | |
PLAYPAUSE: 'paused', | |
SEEK: 'playing', | |
GALLERY_SEEK: 'gallery', | |
NEXT_FRAME: 'paused', | |
PREV_FRAME: 'paused', | |
FF: 'fffb', | |
FB: 'fffb', | |
EOS: 'eos' | |
} | |
}, | |
fffb: { | |
on: { | |
PLAYPAUSE: 'playing', | |
SEEK: 'playing', | |
GALLERY_SEEK: 'gallery', | |
NEXT_FRAME: 'paused', | |
PREV_FRAME: 'paused', | |
FF: 'fffb', | |
FB: 'fffb', | |
EOS: 'eos' | |
} | |
}, | |
eos: { | |
// `eos` includes start and end of stream | |
// `eos` is mostly equivalent to `paused` | |
// a seek to start will be triggered when | |
// upon PLAYPAUSE in `eof` | |
on: { | |
PLAYPAUSE: 'playing', | |
SEEK: 'paused', | |
GALLERY_SEEK: 'gallery', | |
NEXT_FRAME: 'paused', | |
PREV_FRAME: 'paused', | |
FF: 'fffb', | |
FB: 'fffb', | |
} | |
}, | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment