Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created November 3, 2020 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/fb41a61d3427064d9ba65a992b1de57f to your computer and use it in GitHub Desktop.
Save cowboyd/fb41a61d3427064d9ba65a992b1de57f to your computer and use it in GitHub Desktop.
A POJO representing an operation state
type OperationState<T> = {
status: 'unstarted';
} | {
status: 'started';
} | {
status: 'running';
isRunning: true;
} | {
status: 'completed';
value: T;
} | {
status: 'errored';
error: Error;
}
let [perform, cancel] = useEffection(function*({ get, set} ) {
}, initialOperationState)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment