Skip to content

Instantly share code, notes, and snippets.

@motorro
Created July 29, 2022 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motorro/7158e613c08c2e9227165942abe1c675 to your computer and use it in GitHub Desktop.
Save motorro/7158e613c08c2e9227165942abe1c675 to your computer and use it in GitHub Desktop.
Coroutine state
abstract class CoroutineState<G: Any, U: Any>: CommonMachineState<G, U>() {
protected val stateScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
override fun doClear() {
stateScope.cancel()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment