Skip to content

Commit

Permalink
Publish 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Apr 25, 2020
1 parent b76b086 commit e42f8ec
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 77 additions & 23 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
## 1.2.0

- Breaking change: remove `rxdart` dependency

## 1.1.0
- Update rxdart
- Now support extension methods
- Update rxdart
- Now support extension methods

## 1.0.1+1
- Update dependencies
- Update example
- Update dependencies
- Update example

## 1.0.1
- Update dependencies
- Some minor changes
- Update dependencies
- Some minor changes

## 1.0.0+1
- Only change description
- Only change description

## 1.0.0

- Add document, README, tests and some changes
- Add document, README, tests and some changes

## 0.0.9
## 0.0.9

- Initial version, created by Stagehand
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Port from [RxRedux-freeletics](https://github.com/freeletics/RxRedux)

A Redux store implementation entirely based on RxDart (inspired by [redux-observable](https://redux-observable.js.org))
A Redux store implementation entirely based on Dart `Stream`, with the power of RxDart (inspired by [redux-observable](https://redux-observable.js.org))
that helps to isolate side effects. RxRedux is (kind of) a replacement for RxDart's `.scan()` operator.

![RxRedux In a Nutshell](https://github.com/raw/freeletics/RxRedux/master/docs/rxredux.png)
Expand All @@ -19,7 +18,7 @@ dependencies:
```

## How is this different from other Redux implementations
In contrast to any other Redux inspired library out there, this library is really backed on top of RxDart.
In contrast to any other Redux inspired library out there, this library is pure backed on top of Dart Stream.
This library offers a custom stream transformer `ReduxStoreStreamTransformer` (or extension method `reduxStore`) and treats upstream events as `Actions`.

# Redux Store
Expand Down
15 changes: 7 additions & 8 deletions lib/src/redux_store_stream_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:meta/meta.dart';
import 'package:rx_redux/src/reducer.dart';
import 'package:rx_redux/src/reducer_exception.dart';
import 'package:rx_redux/src/side_affect.dart';
import 'package:rxdart/rxdart.dart';

extension ReduxStoreExt<Action> on Stream<Action> {
/// A ReduxStore is a RxDart based implementation of Redux and redux-observable.js.org.
Expand Down Expand Up @@ -88,9 +87,9 @@ class ReduxStoreStreamTransformer<A, S> extends StreamTransformerBase<A, S> {
final len = sideEffects.length;
final sideEffectSubscriptions = List<StreamSubscription<A>>(len);

final actionSubject = PublishSubject<A>();
final addActionToSubject = actionSubject.add;
final addErrorToSubject = actionSubject.addError;
final actionController = StreamController<A>.broadcast();
final addActionToSubject = actionController.add;
final addErrorToSubject = actionController.addError;

StreamController<S> controller;
StreamSubscription<A> subscriptionUpstream;
Expand Down Expand Up @@ -120,8 +119,8 @@ class ReduxStoreStreamTransformer<A, S> extends StreamTransformerBase<A, S> {
if (!controller.isClosed) {
controller.close();
}
if (!actionSubject.isClosed) {
actionSubject.close();
if (!actionController.isClosed) {
actionController.close();
}
}

Expand All @@ -134,7 +133,7 @@ class ReduxStoreStreamTransformer<A, S> extends StreamTransformerBase<A, S> {
controller.add(state);

// This will make the reducer run on each action
subscriptionActionSubject = actionSubject.listen(
subscriptionActionSubject = actionController.stream.listen(
onDataActually,
onError: onErrorActually,
);
Expand All @@ -150,7 +149,7 @@ class ReduxStoreStreamTransformer<A, S> extends StreamTransformerBase<A, S> {
var i = 0;
for (final sideEffect in sideEffects) {
sideEffectSubscriptions[i] = sideEffect(
actionSubject,
actionController.stream,
stateAccessor,
).listen(
addActionToSubject,
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: rx_redux
description: A library that manages state using RxDart. Redux implementation based on RxDart
version: 1.1.0
description: A library that manages state using Dart Stream. Redux implementation based on Dart Stream, with the power of RxDart.
version: 1.2.0
homepage: https://github.com/hoc081098/rx_redux.git
issue_tracker: https://github.com/hoc081098/rx_redux/issues

environment:
sdk: '>=2.6.0 <3.0.0'

dependencies:
rxdart: ^0.23.1
meta: ^1.1.6

dev_dependencies:
pedantic: ^1.0.0
test: ^1.0.0
rxdart: ^0.24.0

0 comments on commit e42f8ec

Please sign in to comment.