Skip to content

Instantly share code, notes, and snippets.

View pavankataria's full-sized avatar

Pavan Kataria pavankataria

View GitHub Profile
@pavankataria
pavankataria / machine.js
Last active February 5, 2021 06:27
Generated by XState Viz: https://xstate.js.org/viz
const lightMachine = Machine({
// not a parallel machine
id: 'parallel',
// initial: 'green',
// states: {
// green: {
// on: { TIMER: 'yellow' }
// },
// yellow: {
@pavankataria
pavankataria / machine.js
Created January 29, 2021 06:48
Generated by XState Viz: https://xstate.js.org/viz
const wizardMachine = Machine({
id: 'wizard',
initial: 'open',
states: {
open: {
initial: 'step1',
states: {
step1: {
on: { NEXT: 'step2' }
},
@pavankataria
pavankataria / machine.js
Created January 15, 2021 04:01
Generated by XState Viz: https://xstate.js.org/viz
const addToUpload = assign({
uploadAmount: (context, event) => context.uploadAmount + 2
});
const addToDownload = assign({
downloadAmount: (context, event) => context.downloadAmount + 2
});
const fileMachine = Machine({
id: 'file',
@pavankataria
pavankataria / machine.js
Created January 5, 2021 00:42
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
// Initial state
initial: 'idle',
// States
states: {
idle: {
on: {
@pavankataria
pavankataria / machine.js
Created January 4, 2021 00:26
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
// Initial state
initial: 'idle',
// States
states: {
idle: {
on: {
@pavankataria
pavankataria / machine.js
Last active January 3, 2021 06:12
Generated by XState Viz: https://xstate.js.org/viz
const factoryViewing = Machine({
id: 'factoryViewing',
initial: 'idle',
states: {
idle: {
on: {
LOAD: 'loading'
}
},
loading: {
@pavankataria
pavankataria / machine.js
Created January 3, 2021 01:01
Generated by XState Viz: https://xstate.js.org/viz
const lightMachine = Machine({
id: 'light',
initial: 'green',
states: {
green: {
on: { TIMER: 'yellow' }
},
yellow: {
on: { TIMER: 'red' }
},
@pavankataria
pavankataria / machine.js
Created January 3, 2021 00:06
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
// Initial state
initial: 'idle',
// States
states: {
idle: {
on: {
@pavankataria
pavankataria / machine.js
Created January 2, 2021 21:03
Generated by XState Viz: https://xstate.js.org/viz
const pedestrianStates = {
initial: 'walk',
states: {
walk: {
on: {
PED_COUNTDOWN: 'wait'
}
},
wait: {
on: {
@pavankataria
pavankataria / machine.js
Created January 2, 2021 20:49
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
// Initial state
initial: 'idle',
// States
states: {
idle: {
on: {