export function* handleIncrementAsync() { yield delay(1000); yield put({type: 'INCREMENT'}); }
function* sagaA2() { yield put(started('a2')) yield delay(100) yield put(stopped('a2')) }
app.get('/api/questions/:id', function*(req, res) { const data = yield getQuestion(req.params.id); yield delay(150); res.json(data); });
async GetNotifications() { console.warn('REAL NOTIFICATION SERVICE! REALLY CONTACTING APIS!'); await delay(1000); return { count: 42 }; }
function* roomsTask(action): any { try { const rooms: Rooms = yield call(API.getRooms) yield delay(300) yield put(actions.successFetchRooms(rooms)) } catch (e) { yield put(actions.failFetchRooms(e)) } }
function* addMovementAsync(action) { yield delay(1000) yield put({ type: ADD_MOVEMENT, payload: action.payload.movement }) yield action.payload.history.push('/') }
function* fetchNews() { // Mock delay from response yield put({type: SET_LOADING,payload:{data:true}}); yield delay(Math.random()*2000+500); yield put({ type: ADD_ARTICLES, payload: {data:news} }); yield put({type: SET_LOADING,payload:{data:false}}); }
export function* sendingContactForm() { try { yield delay(2000); yield put(sendContactFormSuccess()); } catch (error) { yield put(sendContactFormFailure()); } }
function* sagaA1() { yield put(started('a1')) yield delay(100) yield put(stopped('a1')) }
// Our worker Saga: will perform the async increment task function* incrementAsync() { yield delay(1000) yield put({ type: 'INCREMENT' }) }
function* sagaB1() { yield put(started('b1')) yield delay(100) yield put(stopped('b1')) }
async getNotifications() { console.warn("REAL NOTIFICATION SERVICE! REALLY CONTACTING APIS!"); await delay(5000); return { count: 42 }; }
function * increaseAsync(){ yield delay(500) //yield put(push('/')) yield put({ type: 'count.increase' }) }
function* sagaB2() { yield put(started('b2')) yield delay(100) yield put(stopped('b2')) }
async getNotifications() { console.warn("Contacting APIS"); await delay(1000); return { count: 42 }; }