{"size": 622, "ext": "js", "max_stars_repo_path": "examples/blog/sagas/search.js", "max_stars_repo_name": "Trireir/redux-tower", "max_stars_repo_stars_event_min_datetime": "2016-12-26T16:38:05.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-18T17:02:34.000Z", "max_issues_repo_path": "examples/blog/sagas/search.js", "max_issues_repo_name": "Trireir/redux-tower", "max_issues_repo_issues_event_min_datetime": "2016-12-27T02:05:15.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-08T10:07:57.000Z", "max_forks_repo_path": "examples/blog/sagas/search.js", "max_forks_repo_name": "Trireir/redux-tower", "max_forks_repo_forks_event_min_datetime": "2016-12-27T00:39:27.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-21T08:40:11.000Z"}
{"max_stars_count": 125, "max_issues_count": 133, "max_forks_count": 20, "avg_line_length": 23.037037037, "max_line_length": 74, "alphanum_fraction": 0.6848874598}
// @flow

import { delay } from 'redux-saga';
import { fork, call, put } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { REQUEST_SEARCH } from '../actions';
import type { IOEffect } from 'redux-saga/effects';

type Action = {
  payload: {
    type: string;
  };
};

function* searchWithDelay({ payload: action }:Action):Generator<*,void,*>{
  yield call(delay, 500);
  yield put(action);
}

function* handleSearch(): Generator<*,void,*> {
  yield takeLatest(REQUEST_SEARCH, searchWithDelay);
}

export default function* searchSaga(): Generator<IOEffect,void,*> {
  yield fork(handleSearch);
}
