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
| 42Crunch.vscode-openapi | |
| adpyke.vscode-sql-formatter | |
| christian-kohler.npm-intellisense | |
| christian-kohler.path-intellisense | |
| codeandstuff.package-json-upgrade | |
| DavidAnson.vscode-markdownlint | |
| dbaeumer.vscode-eslint | |
| dsznajder.es7-react-js-snippets | |
| eamodio.gitlens | |
| eriklynd.json-tools |
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 lightBulbMachine = Machine({ | |
| id: "house", | |
| initial: "init", | |
| states: { | |
| init: { | |
| entry: "spawnLightBulbs", | |
| on: { | |
| "": "lightsOn" | |
| } | |
| }, |
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 statusMachine = Machine({ | |
| id: 'status-machine', | |
| type: 'parallel', | |
| states: { | |
| polling: { | |
| initial: 'loading', | |
| states: { | |
| loading: { | |
| invoke: { | |
| src: 'sparkRequest', |
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 fetchMachine = Machine({ | |
| id: "spark-status-machine", | |
| initial: "loading", | |
| states: { | |
| loading: { | |
| invoke: { | |
| src: "sparkRequest", | |
| onDone: "success", | |
| onError: "failure" | |
| } |
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 sparkStatus = Machine({ | |
| id: 'status-machine', | |
| initial: 'setup', | |
| context: { | |
| sparkActor: null, | |
| }, | |
| states: { | |
| setup: { | |
| entry: 'spawnSparkStatusUpdater', | |
| on: { |
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 wiseLoadingMachine = Machine({ | |
| id: 'wiseLoadingMachine', | |
| initial: 'idle', | |
| context: { | |
| region: null | |
| }, | |
| states: { | |
| idle: { | |
| on: { | |
| setTab: 'settingTab' |
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
| import { useMachine as useXStateMachine } from '@xstate/react'; | |
| const getStateStat = (state: any): string => { | |
| if (typeof state === 'string') { | |
| return state; | |
| } | |
| if (Object.keys(state).length > 1) { | |
| throw new Error('useMachine does not support emitting stats for parallel 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
| import { useMachine } from '@xstate/react'; | |
| import feedbackMachine from './feedbackMachine'; | |
| const Feedback = () => { | |
| const [current, send] = useMachine(feedbackMachine); | |
| return ...; | |
| }; |
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 |
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 feedbackMachine = Machine({ | |
| id: "feedback", | |
| initial: "idle", | |
| states: { | |
| idle: { | |
| on: { | |
| good: "thanks", | |
| bad: "tellUsWhy" | |
| } | |
| }, |
NewerOlder