Skip to content

Commit 254d555

Browse files
committed
better documentation, changed ActionMgr to ActionDispatcher, changed reducers to reducer
1 parent 1227cdc commit 254d555

22 files changed

+231
-111
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ import 'package:built_redux/built_redux.dart';
7171
* each action and an ActionNames class.
7272
*/
7373
abstract class CounterActions extends ReduxActions {
74-
ActionMgr<int> increment;
75-
ActionMgr<int> decrement;
74+
ActionDispatcher<int> increment;
75+
ActionDispatcher<int> decrement;
7676

7777
// factory to create on instance of the generated implementation of CounterActions
7878
AppStateActions._();
@@ -150,7 +150,7 @@ store.actions.decrement(1);
150150
* Actions to be handled by this middleware
151151
*/
152152
abstract class DoubleAction extends ReduxActions {
153-
ActionMgr<int> increment;
153+
ActionDispatcher<int> increment;
154154

155155
DoubleAction._();
156156
factory DoubleAction() => new _$DoubleAction();
@@ -179,8 +179,8 @@ you must add it to definition of CounterActions like so
179179
180180
```
181181
abstract class CounterActions extends ReduxActions {
182-
ActionMgr<int> increment;
183-
ActionMgr<int> decrement;
182+
ActionDispatcher<int> increment;
183+
ActionDispatcher<int> decrement;
184184

185185
DoubleActions doublerActions;
186186

example/lib/middleware/creation_middleware.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import '../reducers/groups.dart';
1010
part 'creation_middleware.g.dart';
1111

1212
abstract class CreatorActions extends ReduxActions {
13-
ActionMgr<String> createTodo;
14-
ActionMgr<String> createGroup;
13+
ActionDispatcher<String> createTodo;
14+
ActionDispatcher<String> createGroup;
1515

1616
CreatorActions._();
1717
factory CreatorActions() => new _$CreatorActions();
@@ -38,12 +38,12 @@ _createTodo(
3838
..groupId = api.state.currentGroup);
3939
}
4040

41-
_newGroup(String name) => new Group((b) => b
41+
Group _newGroup(String name) => new Group((b) => b
4242
..id = new DateTime.now().millisecondsSinceEpoch
4343
..name = name
4444
..done = false);
4545

46-
_newTodo(String text) => new Todo((b) => b
46+
Todo _newTodo(String text) => new Todo((b) => b
4747
..id = new DateTime.now().millisecondsSinceEpoch
4848
..text = text
4949
..done = false);

example/lib/middleware/creation_middleware.g.dart

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/react_example/module.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ReactElement todoItems(TodoProps props) => Dom.div()(
6666
),
6767
);
6868

69-
ReactElement todoItem(Todo todo, ActionMgr<int> updateTodoStatus) => (Dom.div()..key = todo.id)(
69+
ReactElement todoItem(Todo todo, ActionDispatcher<int> updateTodoStatus) => (Dom.div()..key = todo.id)(
7070
todo.text,
7171
(Dom.input()
7272
..onChange = ((_) => updateTodoStatus(todo.id))

example/lib/reducers/app_state.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import '../middleware/creation_middleware.dart';
1010
part 'app_state.g.dart';
1111

1212
abstract class AppStateActions extends ReduxActions {
13-
ActionMgr<int> setCurrentGroup;
14-
ActionMgr<int> setBogus;
13+
ActionDispatcher<int> setCurrentGroup;
14+
ActionDispatcher<int> setBogus;
1515

1616
GroupsActions groupActions;
1717
TodosActions todosActions;
@@ -29,7 +29,7 @@ _setBogus(AppState state, Action<int> action, AppStateBuilder builder) {
2929
return builder..bogus += action.payload;
3030
}
3131

32-
final _reducers = (new ReducerBuilder<AppStateBuilder>()
32+
final _reducer = (new ReducerBuilder<AppState, AppStateBuilder>()
3333
..add<int>(AppStateActionsNames.setCurrentGroup, _setCurrentGroupReducer)
3434
..add<int>(AppStateActionsNames.setBogus, _setBogus))
3535
.build();
@@ -48,8 +48,8 @@ abstract class AppState extends BuiltReducer<AppState, AppStateBuilder>
4848

4949
TodosReducer get todos;
5050

51-
// The reducers
52-
get reducers => _reducers;
51+
// The reducer
52+
get reducer => _reducer;
5353

5454
// Built value boilerplate
5555
AppState._();

example/lib/reducers/app_state.g.dart

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/reducers/group.g.dart

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/reducers/groups.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import 'group.dart';
99
part 'groups.g.dart';
1010

1111
abstract class GroupsActions extends ReduxActions {
12-
ActionMgr<int> addGroup;
13-
ActionMgr<int> removeGroup;
14-
ActionMgr<AddTodoToGroupPayload> addTodoToGroup;
12+
ActionDispatcher<Group> addGroup;
13+
ActionDispatcher<int> removeGroup;
14+
ActionDispatcher<AddTodoToGroupPayload> addTodoToGroup;
1515

1616
GroupsActions._();
1717
factory GroupsActions() => new _$GroupsActions();
@@ -35,7 +35,7 @@ _addGroupReducer(GroupsReducer state, Action<Group> action, GroupsReducerBuilder
3535
_removeGroupReducer(GroupsReducer state, Action<int> action, GroupsReducerBuilder builder) =>
3636
builder.groupMap.remove(action.payload);
3737

38-
final _reducers = (new ReducerBuilder<GroupsReducerBuilder>()
38+
final _reducer = (new ReducerBuilder<GroupsReducer, GroupsReducerBuilder>()
3939
..add<Group>(GroupsActionsNames.addGroup, _addGroupReducer)
4040
..add<int>(GroupsActionsNames.removeGroup, _removeGroupReducer)
4141
..add<AddTodoToGroupPayload>(GroupsActionsNames.addTodoToGroup, _addTodoToGroupReducer))
@@ -46,8 +46,8 @@ abstract class GroupsReducer extends BuiltReducer<GroupsReducer, GroupsReducerBu
4646
implements Built<GroupsReducer, GroupsReducerBuilder> {
4747
BuiltMap<int, Group> get groupMap;
4848

49-
// The reducers
50-
get reducers => _reducers;
49+
// The reducer
50+
get reducer => _reducer;
5151

5252
GroupsReducer._();
5353
factory GroupsReducer([updates(GroupsReducerBuilder b)]) = _$GroupsReducer;

example/lib/reducers/groups.g.dart

Lines changed: 19 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/reducers/todos.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import 'todo.dart';
99
part 'todos.g.dart';
1010

1111
abstract class TodosActions extends ReduxActions {
12-
ActionMgr<Todo> addTodo;
13-
ActionMgr<int> removeTodo;
14-
ActionMgr<int> updateTodoStatus;
12+
ActionDispatcher<Todo> addTodo;
13+
ActionDispatcher<int> removeTodo;
14+
ActionDispatcher<int> updateTodoStatus;
1515

1616
TodosActions._();
1717
factory TodosActions() => new _$TodosActions();
@@ -29,7 +29,7 @@ updateTodoStatusReducer(TodosReducer state, Action<int> action, TodosReducerBuil
2929
(tbuilder) => tbuilder..done = !tbuilder.done,
3030
);
3131

32-
final _reducers = (new ReducerBuilder<TodosReducerBuilder>()
32+
final _reducer = (new ReducerBuilder<TodosReducer, TodosReducerBuilder>()
3333
..add<Todo>(TodosActionsNames.addTodo, addTodoReducer)
3434
..add<int>(TodosActionsNames.removeTodo, removeTodoReducer)
3535
..add<int>(TodosActionsNames.updateTodoStatus, updateTodoStatusReducer))
@@ -41,8 +41,8 @@ abstract class TodosReducer extends BuiltReducer<TodosReducer, TodosReducerBuild
4141
// global todo list
4242
BuiltMap<int, Todo> get todosMap;
4343

44-
// The reducers
45-
get reducers => _reducers;
44+
// The reducer
45+
get reducer => _reducer;
4646

4747
TodosReducer._();
4848
factory TodosReducer([updates(TodosReducerBuilder b)]) = _$TodosReducer;

0 commit comments

Comments
 (0)