1.0.2 • Published 8 years ago

promise-thunk-retryify v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

promise-thunk-retryify

takes any function that returns a promise and will retry it n number of tries or until successful

import retryify from 'promise-thunk-retryify';

// a pretent promise-based client library to some unreliable API (for instance)
import sketchyAPI from '/path/to/unreliable/data/service.js';

let try5times = retryify(4, sketchyAPI.bind(null, {id: 1}));

try5times()
    .then( doSomethingWithData )
    .catch( sorryItFailed )

API

retrify(n, promiseThunk)

(int, () => Promise ) => () => Promise

where:

  • n number of retry attempts
  • promiseThunk: a function that when invoked (without arguments) returns a promise.

returns a function which when invoked (without arguments) returns a Promise

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago