1 | # Mainstay
|
2 | The definition of Mainstay : a person or thing that acts as a chief support or part. ( [dictonary.com](http://dictionary.reference.com/browse/mainstay) )
|
3 | This module is ment to be the middle piece that links a component that is in a client library built with [Iron(Fe)](https://github.com/jzeltman/iron) and your AEM authored componets.
|
4 |
|
5 | ### Install Mainstay
|
6 | ```node
|
7 | npm install mainstay
|
8 | ```
|
9 |
|
10 | ### Usage
|
11 |
|
12 | ```js
|
13 | var mainstay = require('mainstay');
|
14 | var DataStoar = require('data-stoar');
|
15 |
|
16 | // Componets found by the data store
|
17 | var pageComponents = new DataStoar();
|
18 | // Object of components that are included in client library
|
19 | var clientlibraryComponents = { 'component-name' : require('component-name') };
|
20 |
|
21 | mainstay( pageComponents , clientlibraryComponents );
|
22 |
|
23 | ```
|
24 |
|
25 | ### Usage with Redux
|
26 |
|
27 | ```js
|
28 | var mainstay = require('mainstay');
|
29 | var DataStoar = require('data-stoar');
|
30 |
|
31 | // Componets found by the data store
|
32 | var pageComponents = new DataStoar();
|
33 | // Object of components that are included in client library
|
34 | var clientlibraryComponents = { 'component-name' : require('component-name') };
|
35 |
|
36 | var reduxStore = /* redux init function */
|
37 |
|
38 | mainstay( pageComponents , clientlibraryComponents, reduxStore, true );
|
39 |
|
40 | ```
|
41 |
|
42 | ### Arguments explanation
|
43 |
|
44 | #### PageComponents
|
45 | This is an object of all of the components that are found on the page. The structure of which should follow the structure created by the DataStoar module.
|
46 |
|
47 | #### ClientLibraryComonents
|
48 | This is a object with keys that are exactly the same name of each component being found by the DataStoar module.
|
49 |
|
50 | #### ReduxStore
|
51 | This is the redux store.
|
52 |
|
53 | #### Use Redux
|
54 | This just needs to be a Bool when you want mainstay to wrap each react component in a Provider component.
|