I'm using Redux saga
and OneSignal
in my React Native app. In my saga I have the following generator function:
function* getOneSignalIDs() {
try {
OneSignal.init(appID)
OneSignal.addEventListener('ids', (device) => {
yield put(OneSignalActionCreators.getOneSignalIDsSuccess(device.pushToken, device.userId));
});
} catch(error) {}
}
The problem with this code is that yield put
has to be inside a generator function, but my event listener isn't a generator.
Does anyone know how I can approach this?