Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple scope instances of the same type. #234

Closed
aartikov opened this issue Sep 15, 2018 · 1 comment
Closed

Multiple scope instances of the same type. #234

aartikov opened this issue Sep 15, 2018 · 1 comment
Labels

Comments

@aartikov
Copy link

aartikov commented Sep 15, 2018

It would be nice to be able to create multiple scope instances of the same type.
For example, to make per-request scope, where each request has its own context.

module {
    scope("request") { RequestContext() }
}

val request1 = getKoin().createScope("request")
val request2 = getKoin().createScope("request")

val context1 = get<RequestContext>(scope = request1)
val context2 = get<RequestContext>(scope = request2)
@arnaudgiuliani
Copy link
Member

included in koin 2.0. You can create multiple instance of the same scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants