Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created June 4, 2021 13:07
Show Gist options
  • Save manuelvicnt/67583b98b5af9e7f1c4bc61452320879 to your computer and use it in GitHub Desktop.
Save manuelvicnt/67583b98b5af9e7f1c4bc61452320879 to your computer and use it in GitHub Desktop.
@InstallIn(SingletonComponent::class)
@Module
object CoroutinesScopesModule {
@Singleton // Provide always the same instance
@Provides
fun providesCoroutineScope(): CoroutineScope {
// Run this code when providing an instance of CoroutineScope
return CoroutineScope(SupervisorJob() + Dispatchers.Default)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment