Skip to content

Commit

Permalink
Feature / Create section (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisat authored Mar 29, 2020
1 parent 3198f14 commit 7992926
Show file tree
Hide file tree
Showing 30 changed files with 806 additions and 35 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [Create store](./doc/CreateStore.md)
* [Reducers](./doc/Reducers.md)
* [Middlewares](./doc/Middlewares.md)
* [Sections](./doc/Sections.md)
* [Debugging](./doc/Debugging.md)
* [Use it in React](./doc/React.md)
* [Examples](./doc/Examples.md)
Expand Down Expand Up @@ -276,6 +277,7 @@ Learn the api to master the Dynadux.
- [Create store](./doc/CreateStore.md)
- [Reducers](./doc/Reducers.md)
- [Middlewares](./doc/Middlewares.md)
- [Sections](./doc/Sections.md)
- [Debugging](./doc/Debugging.md)
- 🎉 and that's it, you are mastering the Dynadux!

Expand Down
6 changes: 4 additions & 2 deletions dist/commonJs/Dynadux/Dynadux.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface IDynaduxConfig<TState> {
initialState?: TState;
reducers: IDynaduxReducerDic<TState> | IDynaduxReducerDic<TState>[];
reducers?: IDynaduxReducerDic<TState> | IDynaduxReducerDic<TState>[];
middlewares?: IDynaduxMiddleware<any, any>[];
onDispatch?: (action: string, payload: any) => void;
onChange?: (state: TState) => void;
Expand Down Expand Up @@ -40,9 +40,11 @@ export declare class Dynadux<TState = any> {
private _state;
private readonly _dispatches;
private _isDispatching;
private readonly _reducers;
private _reducers;
constructor(_config: IDynaduxConfig<TState>);
get state(): TState;
setSectionInitialState(section: string, sectionState: any): void;
addReducers: (reducers: IDynaduxReducerDic<TState>) => void;
dispatch: <TPayload>(action: string, payload: TPayload) => void;
private _dispatch;
}
12 changes: 9 additions & 3 deletions dist/commonJs/Dynadux/Dynadux.js

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

2 changes: 1 addition & 1 deletion dist/commonJs/Dynadux/Dynadux.js.map

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { IDynaduxReducerDic } from "../Dynadux/Dynadux";
export declare const convertReducersToSectionReducers: (section: string, sectionReducers: IDynaduxReducerDic<any>) => IDynaduxReducerDic<any>;
29 changes: 29 additions & 0 deletions dist/commonJs/createStore/convertReducersToSectionReducers.js

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

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

15 changes: 13 additions & 2 deletions dist/commonJs/createStore/createStore.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import { IDynaduxConfig, TDynaduxDispatch } from "../Dynadux/Dynadux";
import { IDynaduxConfig, TDynaduxDispatch, IDynaduxReducerDic } from "../Dynadux/Dynadux";
export interface ICreateStoreConfig<TState> extends IDynaduxConfig<TState> {
}
export interface ICreateStoreAPI<TState = any> {
dispatch: TDynaduxDispatch;
state: TState;
dispatch: TDynaduxDispatch;
createSection: <TSectionState>(createSectionConfig: ICreateSectionConfig<TSectionState>) => ICreateSectionAPI<TState, TSectionState>;
}
export interface ICreateSectionConfig<TSectionState> {
section: string;
initialState: TSectionState;
reducers: IDynaduxReducerDic<TSectionState>;
}
export interface ICreateSectionAPI<TState, TSectionState> {
storeState: TState;
state: TSectionState;
dispatch: TDynaduxDispatch;
}
export declare const createStore: <TState = any>(config: ICreateStoreConfig<TState>) => ICreateStoreAPI<TState>;
21 changes: 20 additions & 1 deletion dist/commonJs/createStore/createStore.js

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

2 changes: 1 addition & 1 deletion dist/commonJs/createStore/createStore.js.map

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

6 changes: 4 additions & 2 deletions dist/esNext/Dynadux/Dynadux.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface IDynaduxConfig<TState> {
initialState?: TState;
reducers: IDynaduxReducerDic<TState> | IDynaduxReducerDic<TState>[];
reducers?: IDynaduxReducerDic<TState> | IDynaduxReducerDic<TState>[];
middlewares?: IDynaduxMiddleware<any, any>[];
onDispatch?: (action: string, payload: any) => void;
onChange?: (state: TState) => void;
Expand Down Expand Up @@ -40,9 +40,11 @@ export declare class Dynadux<TState = any> {
private _state;
private readonly _dispatches;
private _isDispatching;
private readonly _reducers;
private _reducers;
constructor(_config: IDynaduxConfig<TState>);
get state(): TState;
setSectionInitialState(section: string, sectionState: any): void;
addReducers: (reducers: IDynaduxReducerDic<TState>) => void;
dispatch: <TPayload>(action: string, payload: TPayload) => void;
private _dispatch;
}
12 changes: 9 additions & 3 deletions dist/esNext/Dynadux/Dynadux.js

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

Loading

0 comments on commit 7992926

Please sign in to comment.