UNPKG

1.74 kBMarkdownView Raw
1# Mainstay
2The definition of Mainstay : a person or thing that acts as a chief support or part. ( [dictonary.com](http://dictionary.reference.com/browse/mainstay) )
3This 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
7npm install mainstay
8```
9
10### Usage
11
12```js
13var mainstay = require('mainstay');
14var DataStoar = require('data-stoar');
15
16// Componets found by the data store
17var pageComponents = new DataStoar();
18// Object of components that are included in client library
19var clientlibraryComponents = { 'component-name' : require('component-name') };
20
21mainstay( pageComponents , clientlibraryComponents );
22
23```
24
25### Usage with Redux
26
27```js
28var mainstay = require('mainstay');
29var DataStoar = require('data-stoar');
30
31// Componets found by the data store
32var pageComponents = new DataStoar();
33// Object of components that are included in client library
34var clientlibraryComponents = { 'component-name' : require('component-name') };
35
36var reduxStore = /* redux init function */
37
38mainstay( pageComponents , clientlibraryComponents, reduxStore, true );
39
40```
41
42### Arguments explanation
43
44#### PageComponents
45This 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
48This is a object with keys that are exactly the same name of each component being found by the DataStoar module.
49
50#### ReduxStore
51This is the redux store.
52
53#### Use Redux
54This just needs to be a Bool when you want mainstay to wrap each react component in a Provider component.