Skip to content

Instantly share code, notes, and snippets.

@RoyalIcing
Created February 15, 2022 06:13
Show Gist options
  • Save RoyalIcing/21dbd15652c8d9a7570f49fba8bda701 to your computer and use it in GitHub Desktop.
Save RoyalIcing/21dbd15652c8d9a7570f49fba8bda701 to your computer and use it in GitHub Desktop.
Loader state machine component
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