Skip to content

Instantly share code, notes, and snippets.

@RBusarow
Created March 17, 2019 23:43
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 RBusarow/c96b37c3856c5cb9966ee9038e67816c to your computer and use it in GitHub Desktop.
Save RBusarow/c96b37c3856c5cb9966ee9038e67816c to your computer and use it in GitHub Desktop.
Simple factory for creating an implementation of a CoroutineScope using a SupervisorJob
fun SupervisorCoroutineScope(
dispatcher: CoroutineDispatcher
): CoroutineScope = object : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = SupervisorJob() + dispatcher
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment