Skip to content

Instantly share code, notes, and snippets.

@RBusarow
Created March 17, 2019 23:43
Show Gist options
  • 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