Created
February 11, 2017 21:37
-
-
Save PierceZ/dcaf2875106a5a2559c1d362f3b9664c to your computer and use it in GitHub Desktop.
An example of using Dagger to make a bus of subjects.
This file contains 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 | |
public class BusModule { | |
public static final String PROVIDER_TOP_SUBJECT = "PROVIDER_TOP_SUBJECT"; | |
public static final String PROVIDER_BOTTOM_SUBJECT = "PROVIDER_BOTTOM_SUBJECT"; | |
@Provides | |
@Singleton | |
@Named(PROVIDER_TOP_SUBJECT) | |
static PublishSubject<String> provideTopSubject() { | |
return PublishSubject.create(); | |
} | |
@Provides | |
@Singleton | |
@Named(PROVIDER_BOTTOM_SUBJECT) | |
static PublishSubject<String> provideBottomSubject() { | |
return PublishSubject.create(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment