1- < << << << HEAD
2- import React , { PropTypes } from 'react '
3- === === =
4- import React , { Component } from 'react '
5- >>> >>> > cb42bba950e45b7b67bfd206c8d9f8440ce429f5
1+ import React , { Component , PropTypes } from 'react'
62import { watchEvents , unWatchEvents } from './actions'
73
84const defaultEvent = {
95 path : '' ,
106 type : 'value'
117}
128
13- < << << << HEAD
149const fixPath = ( path ) => ( ( path . substring ( 0 , 1 ) == '/' ) ? '' : '/' ) + path
1510
1611const isEqualArrays = ( a , b ) => a . length == b . length && a . every ( ( v , i ) => v === b [ i ] )
1712
18- === === =
19- > >>> >>> cb42bba950e45b7b67bfd206c8d9f8440ce429f5
2013const ensureCallable = maybeFn =>
2114 typeof maybeFn === 'function' ? maybeFn : _ => maybeFn
2215
23- << << << < HEAD
2416const flatMap = arr => ( arr && arr . length ) ? arr . reduce ( ( a , b ) => a . concat ( b ) ) : [ ]
25- === === =
26- const flatMap = arr => ( arr && arr . length ) ? arr . reduce ( ( a , b ) => a . concat ( b ) ) : [ ]
27- >>> >>> > cb42bba950e45b7b67bfd206c8d9f8440ce429f5
2817
2918const createEvents = ( { type, path} ) => {
3019 switch ( type ) {
@@ -72,11 +61,7 @@ const getEventsFromDefinition = def => flatMap(def.map(path => {
7261} ) )
7362
7463export default ( dataOrFn = [ ] ) => WrappedComponent => {
75- << << << < HEAD
76- class FirebaseConnect extends React . Component {
77- === === =
7864 class FirebaseConnect extends Component {
79- >>> >>> > cb42bba950e45b7b67bfd206c8d9f8440ce429f5
8065
8166 constructor ( props , context ) {
8267 super ( props , context )
@@ -102,7 +87,6 @@ export default (dataOrFn = []) => WrappedComponent => {
10287 watchEvents ( firebase , dispatch , this . _firebaseEvents )
10388 }
10489
105- << << << < HEAD
10690 componentWillReceiveProps ( nextProps ) {
10791 const { firebase, dispatch} = this . context . store
10892
@@ -115,24 +99,17 @@ export default (dataOrFn = []) => WrappedComponent => {
11599
116100 this . _pathsToListen = newPathsToListen ;
117101
118- === === =
119- componentWillUnmount ( ) {
120- const { firebase } = this . context . store
121- >>> >>> > cb42bba950e45b7b67bfd206c8d9f8440ce429f5
122102 unWatchEvents ( firebase , this . _firebaseEvents )
123103
124104 this . _firebaseEvents = getEventsFromDefinition ( this . _pathsToListen )
125105 watchEvents ( firebase , dispatch , this . _firebaseEvents )
126106 }
127107
128- << << << < HEAD
129108 componentWillUnmount ( ) {
130109 const { firebase} = this . context . store
131110 unWatchEvents ( firebase , this . _firebaseEvents )
132111 }
133112
134- === === =
135- >>> >>> > cb42bba950e45b7b67bfd206c8d9f8440ce429f5
136113 render ( ) {
137114 return (
138115 < WrappedComponent
0 commit comments