Hoop Carpool Fluxy Save

Fluxy is a Flux architecture implementation written in Kotlin.

Project README

Fluxy

What it's all about

Fluxy its a flow arquitecture implementation.

Why flux?

  • Single information flow
  • Single source of truth
  • Reactivity

Where this implementation comes from

This library its created from https://github.com/minikorp/mini

But with a few diferences:

  • Full courroutines implementation
  • 0 auto gen code
  • Easy to understand the core logic

Components

Dispatcher : each time an action was dispatched give it to proper stores.

val dispatcher = Dispatcher()
dispatcher.dispatch(MyAction())

State : represents an immutable state of an application.

data class MyState(val number: String = "")

Action : define a use case, can be synchronous or an asynchronous operation

data class MyAction(val number: String) : BaseAction

Store : is a hoder for a state and has Reducer functions.

class MyStore : FluxyStore<MyState>() {

    init {
        reduce<MyAction> {
            state.copy(number = it.number)
        }
    }
}

Reducer is a pure function that takes an action and current state returning a new state.

How to install

allprojects {
    repositories {
    	maven { url "https://jitpack.io" }
    }
}
dependencies {
    implementation "com.github.hoop-carpool.fluxy:fluxy:x.y.z"  
    implementation "com.github.hoop-carpool.fluxy:timberlogger:x.y.z" // Optional default logger implementation using Timber
}
Open Source Agenda is not affiliated with "Hoop Carpool Fluxy" Project. README Source: hoop-carpool/fluxy
Stars
27
Open Issues
1
Last Commit
2 years ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating