Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created June 4, 2021 13:03
Show Gist options
  • Save manuelvicnt/c2a36efa2516e8551addca8f7b3a3035 to your computer and use it in GitHub Desktop.
Save manuelvicnt/c2a36efa2516e8551addca8f7b3a3035 to your computer and use it in GitHub Desktop.
class ApplicationDiContainer {
// Scoped type. Same instance is always returned
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
// Unscoped type. Always returns a different instance
fun getMyRepository(): MyRepository {
return MyRepository(applicationScope)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment