Created
August 13, 2018 15:35
-
-
Save evianzhow/1eba043dd45ed61a9988095ddac10498 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* @flow */ | |
import MobClick from '@utils/umeng'; | |
import { ActionConst } from 'react-native-router-flux'; | |
import { all, takeEvery, fork } from 'redux-saga/effects'; | |
function* watchPageEnter() { | |
yield takeEvery(ActionConst.FOCUS, function*(action) { | |
const { routeName } = action; | |
MobClick.onPageStart(routeName); | |
__DEV__ && console.log('MobClick onPageStart', routeName); | |
}); | |
} | |
function* watchPageLeave() { | |
yield takeEvery(ActionConst.BLUR, function*(action) { | |
const { routeName } = action; | |
MobClick.onPageEnd(routeName); | |
__DEV__ && console.log('MobClick onPageEnd', routeName); | |
}); | |
} | |
export default function* rootSaga() { | |
yield all([ | |
fork(watchPageEnter), | |
fork(watchPageLeave), | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment