Created
November 3, 2020 20:02
-
-
Save cowboyd/fb41a61d3427064d9ba65a992b1de57f to your computer and use it in GitHub Desktop.
A POJO representing an operation state
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
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