Skip to content

Instantly share code, notes, and snippets.

@ericntd
Created September 9, 2021 17:42
Show Gist options
  • Save ericntd/0a17b9d57ed0e85f4a2bf7acc0cc0d56 to your computer and use it in GitHub Desktop.
Save ericntd/0a17b9d57ed0e85f4a2bf7acc0cc0d56 to your computer and use it in GitHub Desktop.
Feature View module with scope
@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