Comments (3)
Hey, thanks for the Qs!
- A couple reasons. I want this pattern to be more easily accessible to Java Devs. After speaking with a few peeps, it seemed Kotlin was a barrier to entry for some. I didn't want that, esp. with Java 8 support coming to Android N. Secondly, Kotlin requires about 6000 methods between the std lib + runtime. This little library only uses 41 methods, so adding such a huge method count dependency seemed like overkill. Finally, the interface only slightly changed when I moved away from Kotlin, and I was able to mostly fill that gap with the extra
bansa-kotlin
lib. Therefore, the drawbacks were minor, but the wins were big. - I don't have explicit support for a
StoreEnhancer
type as it seemed like quite a functional concept and I was trying to stick more closely to Java Design patterns which is decidedly less functional. Also, I didn't see a huge design advantage to using Store Enhancers rather than wrapping / mutating instances as that's all that's happening under the hood inapplyMiddleware
from the original redux (see https://github.com/reactjs/redux/blob/64a8c66b454163660f9d49bcce92a3230cdbcb2a/src/applyMiddleware.js#L21). So you could still create several "Store Enancers" by composing instances like so:new WrappedStore(new BaseStore(...))
. This is essentially how the Dev Tools in this repo works! That said, do you feel a need for them? Is there something useful there?
from bansa.
Thanks for your kind answers.
- Ah, I see. For me, I already used Kotlin so it doesn't effect me. But your answer makes sense.
- I would love to have something that can sync my Redux store into a persistent storage. In my opinion, the cleanest way to do this is to have a Store Enhancer wrapped over Store and perform serialize/deserialize state into storage for me. I do respect your answer that you want
bansa
to follow closely to Java design paradigm.
from bansa.
Ah, I certainly understand the need for the second! However, rather than a store enhancer, you should be able to achieve that goal in two ways:
- Create a "persistence controller" that listens to state changes and writes to the database every time a state change occurs.
- Create a middleware that operates on specific actions and writes to the dB / network when those actions are dispatched.
Do one of those two options work? If not, let me know and I'll think more about the store enhancer concept!
from bansa.
Related Issues (15)
- InjektionException: No registered instance or factory for type com.brianegan.bansa.Store HOT 6
- Gradle install instructions HOT 1
- Remove Spek
- Implement Redux TimeTravel Dev Tools
- Better Documentation HOT 1
- Explore Component Based Architecture w/ LifeCycle HOT 1
- Support for ScalaJS HOT 1
- Jitpack in README HOT 1
- If I feel like I want to dispatch from my Reducer - what is the correct thing to do instead? HOT 4
- should bansaDevToolsUi be an "aar" instead of jar ? HOT 1
- Is it safe to call dispatch from multiple threads? HOT 6
- Subscribe to substate? HOT 1
- Manage global Store in an Android application HOT 2
- Question: Is this still maintained?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bansa.