Last active
January 27, 2020 10:11
-
-
Save christianhg/1710361a1c60c4d462c4723ab88a5c00 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 fetchMachine = Machine({ | |
id: 'read-only-overlay', | |
type: 'parallel', | |
context: { | |
overlay: { | |
id: '', | |
readOnly: false, | |
readOnlyMessage: undefined, | |
userWarning: undefined | |
} | |
}, | |
states: { | |
inheritance: { | |
initial: 'branched', | |
states: { | |
branched: { | |
initial: 'pristine', | |
on: { | |
INHERITANCE_INSTANTIATED: 'inherited' | |
}, | |
states: { | |
pristine: { | |
on: {DIRTY: 'dirty'} | |
}, | |
dirty: { | |
on: { | |
PRISTINE: 'pristine' | |
} | |
} | |
} | |
}, | |
inherited: { | |
initial: 'idle', | |
on: { | |
INHERITANCE_BROKEN: 'branched', | |
}, | |
states: { | |
idle: { | |
on: { | |
DIRTY_MASTER: 'dirtyMaster' | |
} | |
}, | |
dirtyMaster: { | |
on: { | |
CLEAN_MASTER: 'idle' | |
} | |
} | |
} | |
} | |
} | |
}, | |
print: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
OVERLAY_CHANGED: { | |
target: 'branched', | |
cond: 'overlayIsReadOnly' | |
}, | |
} | |
}, | |
unbranched: { | |
on: { | |
BRANCHED: 'branched' | |
} | |
}, | |
branched: { | |
on: { | |
RELEASED: 'released', | |
UNBRANCHED: 'unbranched' | |
} | |
}, | |
released: { | |
} | |
} | |
}, | |
warning: { | |
initial: 'unwarned', | |
states: { | |
unwarned: { | |
on: { | |
OVERLAY_CHANGED: { | |
target: 'warned', | |
in: 'inheritance.branched.dirty' | |
} | |
} | |
}, | |
warned: { | |
onEntry: ['warnUser'] | |
} | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment