Created
February 15, 2022 06:13
-
-
Save RoyalIcing/21dbd15652c8d9a7570f49fba8bda701 to your computer and use it in GitHub Desktop.
Loader state machine component
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
| export function Loader() { | |
| function* Loading() { | |
| yield on("error", Failed); | |
| yield on("timeout", TimedOut); | |
| yield on("abort", Aborted); | |
| yield on("success", Loaded); | |
| } | |
| function* Failed() {} | |
| function* TimedOut() {} | |
| function* Aborted() {} | |
| function* Loaded() {} | |
| return Loading; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment