0.0.1 • Published 4 years ago

redux-saga-poller v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

redux-saga-poller

CI Status

Saga for consistent polling of async actions

Dispatch the polling start action in FSA format with your desired postfix (default is "_POLL_START").

dispatch({
    type: "GET_ITEMS_POLL_START",
    payload: {
        id: 1,
        interval: 1000,
        request: () => Promise.resolve([1, 2, 3, 4, 5]),
        onContinue: (response) => response.length === 5,
        onSuccess: (response) => {
            alert(response);
        },
        onFailure: (error) => {
            alert(error);
        }
    },
    meta: "Some data"
})

Dispatch the polling stop action in FSA format with your desired stop polling postfix (default is "_POLL_STOP").

dispatch({
    type: "GET_ITEMS_POLL_STOP",
    payload: 1,
})