Created
September 9, 2021 17:42
-
-
Save ericntd/0a17b9d57ed0e85f4a2bf7acc0cc0d56 to your computer and use it in GitHub Desktop.
Feature View module with scope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
class SomeFeatureViewModule() { | |
@Provides | |
@SomeFeatureViewScope | |
fun clickSubject() = PublishSubject.create<Unit>() | |
@Provides | |
@SomeFeatureViewScope | |
fun clickReadStream(clickSubject: PublishSubject<Unit>): Observable<Unit> = subject.throttleFirst(500L, TimeUnit.MILLISECONDS) | |
@Provides | |
@SomeFeatureViewScope | |
fun viewModelFactory() = SomeViewModelFactory(clickReadStream: Observable<Unit>) | |
} | |
@Scope | |
@Retention(AnnotationRetention.RUNTIME) | |
annotation class SomeFeatureViewScope |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment