Last active
March 30, 2020 16:14
-
-
Save pangratz/03e09d293c228c77ce8e4f83d6ab9b45 to your computer and use it in GitHub Desktop.
Revisions
-
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,18 @@ initial: "empty", states: { empty: {}, filled: { on: { MOVE: { target: "empty", actions: assign({ current: null, past: context => [...context.past, context.current] }), cond: "hasCurrent" } } } } }, queue: { -
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,8 @@ MOVE: { target: "empty", actions: assign({ current: context => context.queued[0], queued: context => context.queued.slice(1) }), cond: "hasNext" } -
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,9 @@ on: { MOVE: { target: "empty", actions: assign({ current: context => context.queued[0] }), cond: "hasNext" } } -
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -59,6 +59,7 @@ } }, { guards: { hasCurrent: context => !!context.current, hasNext: context => context.queue.length > 0 } }); -
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,8 @@ on: { MOVE: { target: "empty", actions: assign({}), cond: "hasNext" } } } @@ -56,5 +57,9 @@ } } } }, { guards: { hasNext: context => context.queue.length > 0 } });
-
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,8 @@ filled: { on: { MOVE: { target: "empty", actions: assign({}) } } } -
pangratz revised this gist
Mar 30, 2020 . 1 changed file with 27 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,9 +25,33 @@ type: "parallel", states: { past: { initial: "empty", states: { empty: {}, filled: {} } }, current: { initial: "empty", states: { empty: {}, filled: {} } }, queue: { initial: "empty", states: { empty: {}, filled: { on: { MOVE: { target: "empty" } } } } } } } } -
pangratz created this gist
Mar 30, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const fetchMachine = Machine({ id: 'fetch', initial: 'active', context: { past: [], current: null, queue: [1, 2, 3] }, states: { active: { type: "parallel", states: { past: {}, current: {}, queue: {} } } } });