Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created June 4, 2021 13:12
Show Gist options
  • Save manuelvicnt/40b3abbeb7d710398640258b8ee569de to your computer and use it in GitHub Desktop.
Save manuelvicnt/40b3abbeb7d710398640258b8ee569de to your computer and use it in GitHub Desktop.
@Retention(AnnotationRetention.RUNTIME)
@Qualifier
annotation class ApplicationScope
@InstallIn(SingletonComponent::class)
@Module
object CoroutinesScopesModule {
@Singleton
@ApplicationScope
@Provides
fun providesCoroutineScope(
@DefaultDispatcher defaultDispatcher: CoroutineDispatcher
): CoroutineScope = CoroutineScope(SupervisorJob() + defaultDispatcher)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment