Skip to content

Instantly share code, notes, and snippets.

@jamestthompson3
Last active January 28, 2020 10:00
Show Gist options
  • Save jamestthompson3/2d77491c18d62f8daa6dc4f2e4850255 to your computer and use it in GitHub Desktop.
Save jamestthompson3/2d77491c18d62f8daa6dc4f2e4850255 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 urlMachine = Machine({
id: 'url',
initial: 'servicePath',
states: {
servicePath: {
on: {
ADD_SANDBOX: {
target: 'sandbox',
actions: 'appendSandboxToURL'
},
SET_FULL_PATH: {
target: 'deployment'
}
}
},
sandbox: {
on: {
ADD_DEPLOYMENT: {
target: 'deployment',
actions: 'appendDeploymentToURL'
},
REPLACE_SANDBOX: {
target: 'sandbox',
actions: 'changeSandboxInURL'
},
CHANGE_SERVICE: {
target: 'servicePath',
actions: 'resetURL'
}
}
},
deployment: {
on: {
ADD_QUERY_PARAMS: {
target: 'deployment',
actions: 'addQueryParamsToURL'
},
REPLACE_DEPLOYMENT: {
target: 'deployment',
actions: 'changeDeploymentInURL'
},
CHANGE_SANDBOX: {
target: 'sandbox',
actions: 'changeSandboxInURL'
},
CHANGE_SERVICE: {
target: 'servicePath',
actions: 'resetURL'
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment