Skip to content

Commit

Permalink
Add getStore support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbmeads committed Jul 4, 2016
1 parent 4ec61bd commit 8982299
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# [Rille + React](http://www.rille.io) [![Build Status](https://img.shields.io/travis/dbmeads/rille-react/master.svg?style=flat-square)](https://travis-ci.org/dbmeads/rille-react) [![Coverage Status](https://img.shields.io/coveralls/dbmeads/rille-react/master.svg?style=flat-square)](https://coveralls.io/github/dbmeads/rille-react?branch=master) [![npm version](https://img.shields.io/npm/v/rille-react.svg?style=flat-square)](https://www.npmjs.com/package/rille-react) [![npm downloads](https://img.shields.io/npm/dm/rille-react.svg?style=flat-square)](https://www.npmjs.com/package/rille-react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md#pull-requests)

**(DISCLAIMER: This project is in early development and subject to heavy change.)**

## Quick Links

#### General
Expand Down Expand Up @@ -37,7 +35,9 @@ TBD
## Component

```js
Component();

import

```

[Back To Top](#quick-links)
Expand Down
3 changes: 2 additions & 1 deletion dist/lib/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ global.React = _react2.default;

function Component(spec) {
var _getInitialState = spec.getInitialState;
var getStore = spec.getStore;
var componentDidMount = spec.componentDidMount;
var componentWillUnmount = spec.componentWillUnmount;


return _react2.default.createClass(Object.assign(spec, {
getInitialState: function getInitialState() {
var store = this.store = this.props && this.props.store || spec.store;
var store = this.store = getStore ? getStore.call(this) : this.props && this.props.store || spec.store;
if (store) {
var unsubscribe;

Expand Down
4 changes: 2 additions & 2 deletions lib/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'react';
global.React = React;

function Component(spec) {
const {getInitialState, componentDidMount, componentWillUnmount} = spec;
const {getInitialState, getStore, componentDidMount, componentWillUnmount} = spec;

return React.createClass(Object.assign(spec, {
getInitialState() {
var store = this.store = (this.props && this.props.store) || spec.store;
var store = this.store = getStore ? getStore.call(this) : (this.props && this.props.store) || spec.store;
if (store) {
var unsubscribe;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rille-react",
"version": "0.11.0",
"version": "0.12.0",
"description": "Rille + React",
"main": "dist/lib/index.js",
"author": "dbmeads@hotmail.com",
Expand Down

0 comments on commit 8982299

Please sign in to comment.