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 characters
| const readOnlyMachine = Machine({ | |
| id: "readOnly", | |
| initial: "listing", | |
| context: { | |
| id: null | |
| }, | |
| states: { | |
| listing: { | |
| on: { | |
| READ: { |
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 characters
| const managerMachine = Machine({ | |
| id: 'manager', | |
| initial: 'pending', | |
| context: { | |
| space: null, | |
| environment: null | |
| }, | |
| states: { |
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 characters
| const FLIGHT_PER_MINUTE = 1; | |
| const BASIC_CHARGER = 1.2; | |
| const FAST_CHARGER = 2.4; | |
| const ONE_MINUTE = 1000 * 60; | |
| const MIN_CHARGE = 0; | |
| const MAX_CHARGE = 100; | |
| const getBatteryCapacity = (timeInMinutes) => { | |
| return FLIGHT_PER_MINUTE * timeInMinutes; | |
| } |
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 characters
| const EMPTY_TANK = 0; | |
| const toiletMachine = Machine({ | |
| id: 'toilet', | |
| context: { | |
| flushSpeed: 1, | |
| fillSpeed: 0.5, | |
| tankAmount: 6, | |
| tankCapacity: 6 |
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 characters
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |