Skip to content

Instantly share code, notes, and snippets.

View avanslaars's full-sized avatar

Andy Van Slaars avanslaars

View GitHub Profile
@avanslaars
avanslaars / machine.js
Last active November 12, 2019 18:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@avanslaars
avanslaars / machine.js
Created November 12, 2019 18:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@avanslaars
avanslaars / machine.js
Last active November 12, 2019 18:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@avanslaars
avanslaars / machine.js
Last active March 2, 2020 21:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@avanslaars
avanslaars / machine.js
Created November 16, 2019 14:23
Generated by XState Viz: https://xstate.js.org/viz
const toggleMachine = Machine({
id: 'toggle',
initial: 'active',
states: {
active: {
on: {
TOGGLE: 'inactive'
}
},
inactive: {
@avanslaars
avanslaars / machine.js
Created November 16, 2019 18:06
Generated by XState Viz: https://xstate.js.org/viz
const viewMachine = Machine({
id: 'view',
initial: 'read',
states: {
read: {
initial: 'tab1',
on: {
EDIT: 'edit'
},
states: {
@avanslaars
avanslaars / machine.js
Last active March 16, 2020 13:49
Generated by XState Viz: https://xstate.js.org/viz
// Fetch with retry and cancel
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
context: {
results: [],
retries: 0,
},
states: {
idle: {
@avanslaars
avanslaars / machine.js
Last active March 11, 2020 13:28
Generated by XState Viz: https://xstate.js.org/viz
const SignalMachine = Machine({
id: 'signal',
initial: 'red',
states: {
red: {
after: {
1000: 'green',
},
},
@avanslaars
avanslaars / machine.js
Last active March 11, 2020 13:28
Generated by XState Viz: https://xstate.js.org/viz
const SignalMachine = Machine({
id: 'signal',
initial: 'red',
states: {
red: {
on: {
TIMER: 'green',
},
after: {
1000: 'green',
@avanslaars
avanslaars / machine.js
Last active March 3, 2020 20:17
fetch machine including retry with backoff logic - Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine(
{
id: 'fetch',
initial: 'idle',
context: {
results: [],
retryCount: 0,
},
states: {
idle: {