GithubHelp home page GithubHelp logo

beyondeye / reduks Goto Github PK

View Code? Open in Web Editor NEW
111.0 111.0 10.0 1.33 MB

A "batteries included" port of Reduxjs for Kotlin+Android

License: Apache License 2.0

Kotlin 72.46% Java 27.54%
kotlin-android redux

reduks's People

Contributors

beyondeye avatar charbgr avatar judrummer avatar kittinunf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

reduks's Issues

integrate event bus pattern with reduks

The event bus pattern is very useful in Android for passing data between activities and fragments, instead of using awful callbacks like OnActivityResult. Reduks is kind of similar to in architecture to an event bus but not exactly the same. When trying to use Reduks to pass data (dispatch) to subscribers, need to add a lot of boilerplate to handle the intermediate processing by reducers to the store before the data reach subscribers. I should probably write a store enhancer to reduce the boilerplate.

Reduce method count in reduks core

After adding support for modules, method count in reduks core has increased to significantly (the module package has now 524 method). Need to find a way to reduce it. Using data classes for module def was a bad idea probably, because it adds tons of methods I don't actually need. See attached full list of methods
core_method_list.txt

Android global application store/state

Hi,

I am currently learning to implement this architecture in a small Android app but I am not sure where I should create and keep my Store? How would I handle saving/restoring the state if I do it in a application wide Singleton? Or would it be a good idea to use the Android Arch. Components ViewModel Class and create a store for every activity?

Thanks for your input!

Add phantom Action as a phantom type for all action

Thanks so much for this library!

How do you feel about having a phantom type for all action? I personally feel that the usage of Object for an action is too broad. This could be a simple and empty interface that provide a loose frame for all user action to follow.

interface Action

Another thing on my mind right now is having a Standard action for Reduks. It is pretty much similar to "upstream" redux.js counterpart where they define a recommended-but-not-mandatory structure for Action. You could look at here for the reference, flux-standard-action. This could be something similar to this

interface StandardAction {
   val payload: Any?
   val error: Boolean 
   val meta: Any?
}

What do you think?

Make reselect work for null values

withField requires a non-null value:
fun<I1 : Any> withField(fn: S.() -> I1) = SelectorForP2<S, I0, I1>(si0, InputField(fn)), where I1: Any

Say we have a state like:
data class MyState(val apiResult: ApiResult?)

Writing SelectorBuilder<MyState>().withField { apiResult } won't compile because ApiResult? is not a subtype of Any

Is there another way to circumvent this?

introduce separate modules reduks-rx-android and reduks-kovenant-android

Currently the reduks-android module does not have any real android dep, just an interface called interface ReduksActivity<S> that does not actually depends on android activity.
What about reintegrating ReduksActivity<S> in core and creating instead two modules with real dependency on android, one for rx (RxReduksActivity) and one for kovenant (KovenantReduksActivity).

Or perhaps explore a different a way to do this: the need of having a base activity class for using reduks is an ugly design pattern.

Remove all Java dependency/code from core

Reduks can be potentially used for developing applications for both android and web. Reduks core already does not depend from any java library, but there are still some interfaces kept in Java for leveraging automatic SAM conversion.
It should be easy substitute them with pure kotlin code

epics and saga middleware

In my effort to improve support for rx and provide better middleware for async action, I should implement
epics and saga.
For epics see for reference https://redux-observable.js.org/docs/basics/Epics.html
There is also an implementation in kotlin for rxjava by Michael Pardo here: https://github.com/pardom/redux-observable-kotlin
A very similar middleware that is independent from rx is redux-saga
http://yelouafi.github.io/redux-saga/
I could implement both, merging interfaces, for having the same functionality both when using rxjava or something else (kotlin coroutines/ kovenant promises)

Remove State snapshot from StoreSubscriber

Based on main redux documentation, listener function signature is subscribe(listener: () => void): Unsubscribe;

https://github.com/reactjs/redux/blob/master/docs/FAQ.md#how-do-i-subscribe-to-only-a-portion-of-the-state-can-i-get-the-dispatched-action-as-part-of-the-subscription

I propose we should match that in other words, we remove the state argument from StoreSubscriber

From

public interface StoreSubscriber<S> {
    void onStateChange(S state);
}

To

public interface StoreSubscriber<S> {
    void onStateChange();
}

Then it is responsibility of the call site to call store.state in order to get current state value.

Add examples

Would you please mind creating some examples using Reduks, e.g. a to-do list?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.