Last active
November 9, 2020 18:48
-
-
Save pangratz/f1e68d0743abdc3fa728e6d4bf94e009 to your computer and use it in GitHub Desktop.
Revisions
-
pangratz revised this gist
Nov 9, 2020 . 1 changed file with 1 addition and 2 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,8 +25,7 @@ "connecting": { entry: [ "clean current socket", "increase connection counter" ], on: { "connection counter OK": { -
pangratz created this gist
Nov 9, 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,60 @@ // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const fetchMachine = Machine({ id: 'fetch', initial: 'not connected', states: { "not connected": { on: { "connect(ip)": { target: "connecting" }, } }, "connecting": { entry: [ "clean current socket", "increase connection counter", "check connection attempts" ], on: { "connection counter OK": { target: "connectToSocketTask running", actions: [ "start timeout task", "start connectToSocketTask" ] }, "too many connection attempts": "error" } }, "connectToSocketTask running": { on: { "timeout task finished": { target: "connecting" }, "connectSocketTask finished": { target: "setupSocketConnection" } } }, "setupSocketConnection": {}, "error": {} } });