-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from factory to provider, like react-redux
Also borrowed some code from them, hehe
- Loading branch information
Showing
5 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
module.exports = require('./build/exothermic') | ||
module.exports = { | ||
connect: require('./build/connect'), | ||
Provider: require('./build/Provider'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {Component, PropTypes, Children} from 'react'; | ||
import firebaseShape from './firebaseShape' | ||
|
||
export default class Provider extends Component { | ||
static propTypes = { | ||
firebase: firebaseShape.isRequired, | ||
children: PropTypes.element.isRequired, | ||
} | ||
|
||
static childContextTypes = { | ||
firebase: firebaseShape.isRequired, | ||
} | ||
|
||
getChildContext() { | ||
return {firebase: this.firebase}; | ||
} | ||
|
||
constructor(props, context) { | ||
super(props, context); | ||
this.firebase = props.firebase; | ||
} | ||
|
||
render() { | ||
const {children} = this.props; | ||
return Children.only(children); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {PropTypes} from 'react'; | ||
|
||
export default PropTypes.shape({ | ||
child: PropTypes.func.isRequired, | ||
on: PropTypes.func.isRequired, | ||
off: PropTypes.func.isRequired, | ||
}); |