Last active
March 9, 2020 13:40
-
-
Save saschwarz/2ad7eeda381f43a4139c01df82d2a9ad to your computer and use it in GitHub Desktop.
Revisions
-
saschwarz revised this gist
Mar 9, 2020 . No changes.There are no files selected for viewing
-
saschwarz revised this gist
Mar 9, 2020 . 1 changed file with 10 additions and 10 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 @@ -31,16 +31,16 @@ const dogPlay = Machine({ }, }, on: { DOOR_OPEN: { actions: [ assign({doorOpen: _ => true}) ], }, DOOR_CLOSE: { actions: [ assign({doorOpen: _ => false}) ] }, } }, { -
saschwarz revised this gist
Mar 9, 2020 . 1 changed file with 11 additions and 11 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 @@ -1,4 +1,4 @@ const dogPlay = Machine({ id: 'dogplay', initial: 'sleeping', @@ -31,16 +31,16 @@ const dogPlay = Machine({ }, }, on: { DOOR_OPEN: { actions: [ assign({doorOpen: _ => true}) ], }, DOOR_CLOSE: { actions: [ assign({doorOpen: _ => false}) ] }, } }, { -
saschwarz revised this gist
Mar 8, 2020 . 1 changed file with 11 additions and 11 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 @@ -1,4 +1,4 @@ // Include door/open close guards const dogPlay = Machine({ id: 'dogplay', initial: 'sleeping', @@ -31,16 +31,16 @@ const dogPlay = Machine({ }, }, on: { DOOR_OPEN: { actions: [ assign({doorOpen: _ => true}) ], }, DOOR_CLOSE: { actions: [ assign({doorOpen: _ => false}) ] }, } }, { -
saschwarz created this gist
Mar 8, 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,50 @@ const dogPlay = Machine({ id: 'dogplay', initial: 'sleeping', context: { doorOpen: false, }, states: { sleeping: { on: { LETS_PLAY: 'standing' } }, standing: { on: { SIT: 'sitting' } }, sitting: { on: { STAND: 'standing', FREE: [ { target: 'outside', cond: 'doorIsOpen', }, { target: 'standing' }], }, }, outside: { }, }, on: { DOOR_OPEN: { actions: [ assign({doorOpen: _ => true}) ], }, DOOR_CLOSE: { actions: [ assign({doorOpen: _ => false}) ] }, } }, { guards: { doorIsOpen: (context, event) => context.doorOpen } })