Skip to content

Commit 788bd49

Browse files
authored
Enhancement/add jsdoc (#12)
* added basic jsdoc info * added jsdoc, docs and documentation.md * added validation for input passed to dispatch * updated module exports * updated documentation * 0.2.0
1 parent f8daed2 commit 788bd49

File tree

8 files changed

+689
-10
lines changed

8 files changed

+689
-10
lines changed

DOCUMENTATION.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
## Modules
2+
3+
<dl>
4+
<dt><a href="#module_connect">connect</a></dt>
5+
<dd></dd>
6+
<dt><a href="#module_createStore">createStore</a> ⇒ <code>Node</code> | <code>function</code></dt>
7+
<dd><p>Creates an global store.</p>
8+
</dd>
9+
<dt><a href="#module_provider">provider</a></dt>
10+
<dd></dd>
11+
</dl>
12+
13+
<a name="module_connect"></a>
14+
15+
## connect
16+
<a name="module_connect..actionCallback"></a>
17+
18+
### connect~actionCallback(actionCallback)
19+
To dispatch values to global store.
20+
21+
**Kind**: inner method of [<code>connect</code>](#module_connect)
22+
23+
| Param | Type | Description |
24+
| --- | --- | --- |
25+
| actionCallback | <code>function</code> | A function that receives dispatch function as a param |
26+
27+
<a name="module_createStore"></a>
28+
29+
## createStore ⇒ <code>Node</code> \| <code>function</code>
30+
Creates an global store.
31+
32+
**Returns**: <code>Node</code> - - Returns a wrapper provider component<code>function</code> - - A "connect" function to connect a component with global state
33+
34+
| Param | Type | Description |
35+
| --- | --- | --- |
36+
| defaultState | <code>Object</code> | The default state of the application need to create the store |
37+
38+
39+
* [createStore](#module_createStore) ⇒ <code>Node</code> \| <code>function</code>
40+
* [~dispatch(options)](#module_createStore..dispatch)
41+
* [~connect(select, component)](#module_createStore..connect) ⇒ <code>Node</code>
42+
43+
<a name="module_createStore..dispatch"></a>
44+
45+
### createStore~dispatch(options)
46+
To update values in global store.
47+
48+
**Kind**: inner method of [<code>createStore</code>](#module_createStore)
49+
50+
| Param | Type | Description |
51+
| --- | --- | --- |
52+
| options | <code>Object</code> | A object with the details to update values in global store |
53+
| options.key | <code>string</code> | KeyPath to which the value has to be assigned, separated by '.' |
54+
| options.payload | <code>Object</code> | Value to be set against the provided Keypath |
55+
56+
<a name="module_createStore..connect"></a>
57+
58+
### createStore~connect(select, component) ⇒ <code>Node</code>
59+
Connects the passed component with the global store.
60+
61+
**Kind**: inner method of [<code>createStore</code>](#module_createStore)
62+
**Returns**: <code>Node</code> - - A wrapper React element
63+
64+
| Param | Type | Description |
65+
| --- | --- | --- |
66+
| select | <code>function</code> | To map global state to props, should return an JSON object |
67+
| component | <code>Node</code> | A React element, to which the props has to be passed |
68+
69+
<a name="module_provider"></a>
70+
71+
## provider
72+
73+
* [provider](#module_provider)
74+
* [~Provider](#module_provider..Provider)
75+
* [new Provider()](#new_module_provider..Provider_new)
76+
77+
<a name="module_provider..Provider"></a>
78+
79+
### provider~Provider
80+
**Kind**: inner class of [<code>provider</code>](#module_provider)
81+
**Properties**
82+
83+
| Name | Type | Description |
84+
| --- | --- | --- |
85+
| defaultState | <code>object</code> | The default state of the application need to create the store, if not passed as part of createStore |
86+
| children | <code>Node</code> | React element for which the store should be made available |
87+
88+
<a name="new_module_provider..Provider_new"></a>
89+
90+
#### new Provider()
91+
Provider Component.
92+

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ npm i react-context-redux --save
1111
```
1212

1313
```
14-
<script src="https://unpkg.com/react-context-redux@0.1.0/umd/react-context-redux.min.js" crossorigin></script>
14+
<script src="https://unpkg.com/react-context-redux/umd/react-context-redux.min.js" crossorigin></script>
15+
```
16+
Or use it with a specific version you need
17+
18+
```
19+
<script src="https://unpkg.com/react-context-redux@0.2.0/umd/react-context-redux.min.js" crossorigin></script>
1520
```
1621

1722
## Usage

0 commit comments

Comments
 (0)