Skip to content

Instantly share code, notes, and snippets.

@kellyjandrews
Last active June 29, 2020 17:35
Show Gist options
  • Save kellyjandrews/2d260c1f9c7b51ed47c4cf7bbc61b4df to your computer and use it in GitHub Desktop.
Save kellyjandrews/2d260c1f9c7b51ed47c4cf7bbc61b4df to your computer and use it in GitHub Desktop.

Revisions

  1. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 5 additions and 18 deletions.
    23 changes: 5 additions & 18 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,8 @@
    const shoppingCard = Machine({
    id: 'shoppingCart',
    initial: 'empty',
    const video = Machine({
    id: 'video',
    initial: 'disconnected',
    states: {
    empty: {
    on: {
    ADD_ITEM: 'full'
    }
    },
    full: {
    on: {
    ADD_ITEM: 'full',
    CHECKOUT: 'checkout',
    EMPTY_CART: 'empty'
    }
    },
    checkout: {
    type: 'final'
    }
    disconnected: {},
    connected: {}
    }
    });
  2. kellyjandrews created this gist Jun 29, 2020.
    21 changes: 21 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    const shoppingCard = Machine({
    id: 'shoppingCart',
    initial: 'empty',
    states: {
    empty: {
    on: {
    ADD_ITEM: 'full'
    }
    },
    full: {
    on: {
    ADD_ITEM: 'full',
    CHECKOUT: 'checkout',
    EMPTY_CART: 'empty'
    }
    },
    checkout: {
    type: 'final'
    }
    }
    });