All Projects → bcherny → redrock

bcherny / redrock

Licence: MIT license
Typesafe, reactive redux

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to redrock

Rx Connect
Glue your state and pure React components with RxJS
Stars: ✭ 86 (+514.29%)
Mutual labels:  flux, reactive, rxjs, rx
Toy Rx
A tiny implementation of RxJS that actually works, for learning
Stars: ✭ 290 (+1971.43%)
Mutual labels:  reactive, rxjs, rx
Rxviz
Rx Visualizer - Animated playground for Rx Observables
Stars: ✭ 1,471 (+10407.14%)
Mutual labels:  reactive, rxjs, rx
Reactor Core
Non-Blocking Reactive Foundation for the JVM
Stars: ✭ 3,891 (+27692.86%)
Mutual labels:  flux, reactive
RxReduxK
Micro-framework for Redux implemented in Kotlin
Stars: ✭ 65 (+364.29%)
Mutual labels:  flux, rx
Fluorine
[UNMAINTAINED] Reactive state and side effect management for React using a single stream of actions
Stars: ✭ 287 (+1950%)
Mutual labels:  flux, rxjs
Qactive
Reactive queryable observable framework.
Stars: ✭ 147 (+950%)
Mutual labels:  reactive, rx
Scalecube Services
v2.0 - ScaleCube Services provides a low latency Reactive Microservices library for serverless service registry and discovery based on gossip protocol and without single point-of-failure or bottlenecks.
Stars: ✭ 23 (+64.29%)
Mutual labels:  flux, reactive
Reatom
State manager with a focus of all needs
Stars: ✭ 567 (+3950%)
Mutual labels:  flux, reactive
Reactive Flux
Fluxish model implemented with RxJS
Stars: ✭ 71 (+407.14%)
Mutual labels:  flux, rxjs
Influxdb Client Csharp
InfluxDB 2.0 C# Client
Stars: ✭ 130 (+828.57%)
Mutual labels:  flux, reactive
assembler
Functional, type-safe, stateless reactive Java API for efficient implementation of the API Composition Pattern for querying/merging data from multiple datasources/services, with a specific focus on solving the N + 1 query problem
Stars: ✭ 102 (+628.57%)
Mutual labels:  flux, reactive
Aesthetic
[DEPRECATED]
Stars: ✭ 2,044 (+14500%)
Mutual labels:  reactive, rx
Vueflux
♻️ Unidirectional State Management Architecture for Swift - Inspired by Vuex and Flux
Stars: ✭ 315 (+2150%)
Mutual labels:  flux, reactive
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (+1064.29%)
Mutual labels:  reactive, rxjs
Tanok
Elm Architecture-inspired wrapper for Rx.js+React
Stars: ✭ 22 (+57.14%)
Mutual labels:  flux, rxjs
Reactor Netty
TCP/HTTP/UDP/QUIC client/server with Reactor over Netty
Stars: ✭ 1,743 (+12350%)
Mutual labels:  flux, reactive
Influxdb Client Python
InfluxDB 2.0 python client
Stars: ✭ 165 (+1078.57%)
Mutual labels:  flux, reactive
Redux Most
Most.js based middleware for Redux. Handle async actions with monadic streams & reactive programming.
Stars: ✭ 137 (+878.57%)
Mutual labels:  reactive, rxjs
Marble
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.
Stars: ✭ 1,947 (+13807.14%)
Mutual labels:  reactive, rxjs

Redrock: Typesafe, reactive redux

Build Status npm mit

Highlights

  • 100% type-safe:
    • Statically guarantees that a reducer is defined for each Action
    • Statically guarantees that emitters are called with the correct Action data given their Action name
    • Statically guarantees that listeners are called with the correct Action data given their Action name
  • Mental model similar to Redux, with several improvements over Redux:
    • Store is decoupled from emitter
    • Emitters are reactive; in fact, they use Rx Observables!
    • Listeners are on specific Actions
    • Listeners are called with both current and previous values (convenience borrowed from Angular $watch/Object.Observe)

Conceptual Overview

  1. Create a redrock Emitter with a set of supported Actions
  2. Register reducers on the emitter (a "reducer" is a mapping from a given Action to its side effects)
  3. Components in your app emit() Actions on your emitter
  4. Actions first trigger side-effects (via their respective reducers), then trigger any callbacks listening on that Action (callbacks are registered with on())

Installation

npm install redrock --save

Usage

import { Emitter } from 'redrock'

// Mock store
const store: { [id: number]: boolean } = {}

// Enumerate actions
type Actions = {
  INCREMENT_COUNTER: number
  OPEN_MODAL: boolean
}

// Define redrock Emitter
class App extends Emitter<Actions> { }

// Create bus and register reducers (throws a compile time error unless both of these keys are defined, and return values of the right types)
const app = new App({
  INCREMENT_COUNTER: ({ id, value }) => {
    const previousValue = store[id]
    store[id] = value
    return previousValue
  },
  OPEN_MODAL: ({ id, value }) => {
    const previousValue = store[id]
    store[id] = value
    return previousValue
  }
})

// Listen on an action (throws a compile time error if this event does not exist) (basic)
app.on('OPEN_MODAL')
   .subscribe(_ => _.value)

// Listen on an action (advanced)
app.on('INCREMENT_COUNTER')
   .filter(_ => _.id === 42)
   .debounce()
   .subscribe(_ => console.log(`Counter incremented from ${_.previousValue} to ${_.value}!`))

// Trigger an action (throws a compile time error unless id and value are set, and are of the right types)
app.emit('OPEN_MODAL', { id: 123, value: true })

Tests

npm test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].