Closed eriuzo closed 8 years ago
Hi @eriuzo
So normally you will create a store as singleton to keep the data that might be used across the app.
i.e: UserStore, contains all the data related to user so probably you want to keep this store as a singleton.
But notice that this is up to you. RxFlux won't create the store as singleton, this is up to the dev. What RxFlux does is asking you to subscribe them on activity starts. What I am realizing is that the stores itself just unsubscribe when the app gets destroyed. So if you need to force a store to be unsubscribe you can do it by yourself dispatcher.unregister(store)
I am working on a modification of some interface I will consider that. To make it more easy.
so, for stores local to the activity, i can register at onResume
and unregister at onPause
right?
for stores that is depended by more than one activity i can make them singleton.
exactly. I will try to improve that but for now is how you should do it.
El jue., 7 abr. 2016 a las 9:13, eriuzo (notifications@github.com) escribió:
so, for stores local to the activity, i can register at onResume and unregister at onPause right? for stores that is depended by more than one activity i can make them singleton.
— You are receiving this because you commented.
Reply to this email directly or view it on GitHub https://github.com/skimarxall/RxFlux/issues/9#issuecomment-206727980
So if you need to force a store to be unsubscribe you can do it by yourself dispatcher.unregister(store)
Actually there are many unregister methods:
public <T extends RxActionDispatch> void unregisterRxAction(final T object)
public <T extends RxViewDispatch> void unregisterRxError(final T object)
public <T extends RxViewDispatch> void unregisterRxStore(final T object)
I suppose I should use unregisterRxStore
right?
But in RxStore
class the register
method does this: dispatcher.registerRxAction(this);
So what is actually I need to call? Thanks.
That's the interface I am changing, they are confusing. The registerRxStore actually is used by the activity to registers the store when RxFlux ask for. And registerRxAction is used by the store to register for RxAction.
So you should call unregisterRxAction(storeInstance)
I will try to have a fix ASAP.
El jue., 7 abr. 2016 a las 11:40, eriuzo (notifications@github.com) escribió:
So if you need to force a store to be unsubscribe you can do it by yourself dispatcher.unregister(store)
Actually there are many unregister methods:
- public
void unregisterRxAction(final T object) - public
void unregisterRxError(final T object) - public
void unregisterRxStore(final T object) I suppose I should use unregisterRxStore right?
But in RxStore class the register method does this https://github.com/skimarxall/RxFlux/blob/master/rxflux/src/main/java/com/hardsoftstudio/rxflux/store/RxStore.java#L20: dispatcher.registerRxAction(this);
So what is actually I need to call? Thanks.
— You are receiving this because you commented.
Reply to this email directly or view it on GitHub https://github.com/skimarxall/RxFlux/issues/9#issuecomment-206786277
alright, thanks for the clarification.
Hi, I noticed you changed the interface in PR #10 . Can you release it? What are changes we users need to do? Thanks.
Yes sorry that I could not do it earlier. The version 0.3.2 includes the changes.
compile 'com.hardsoftstudio:rxflux:0.3.2'
I will try to update the documentation.
I want to see your latest changes,Waiting,Thanks
You can check the example is updated with the new version. I could not find time to update the docs sorry.
@skimarxall Thanks,example is very good.
Can RxFlux use Dagger2?I'm learning Dagger2
@coolfire2015 yeah
Hi, i want to ask a question.
How am I supposed to approach multiple activities? A store per activity or a central store used by all activities?
Right now I have 2 activities, say outer -> inner. They have different use case / flow/state so I created two stores. The problem is outer store also get the action meant to be consumed by inner store.
For simple action/data this is no problem, but in case I want to pass something big, this situation will lead to a waste of memory. when i have 20 stores there will be potentially 19 waste.
Please advise.