Because everyone loves a tryer! Conditional and repeated task invocation for node and browser.




Because everyone loves a tryer!
Conditional
and repeated
function invocation
for node
and browser.
* Say what?
* What size is it?
* How do I install it?
* How do I use it?
* Loading the library
* Calling the exported function
* Examples
* How do I set up the dev environment?
* What license is it released under?
Sometimes,
you want to defer
calling a function
until a certain
pre-requisite condition is met.
Other times,
you want to
call a function
repeatedly
until some post-requisite condition
is satisfied.
Occasionally,
you might even want
to do both
for the same function.
To save you writing
explicit conditions
and loops
on each of those occasions,tryer implements
a predicate-based approach
that hides the cruft
behind a simple,
functional interface.
Additionally,
it allows you to easily specify
retry intervals
and limits,
so that your code
doesn't hog the CPU.
It also supports
exponential backoff
of retry intervals,
which can be useful
when handling
indefinite error states
such as network failure.
5.6 kb unminified with comments, 1.1 kb minified, 0.5 kb minified + gzipped.
Via npm:
```
npm i tryer --save
Or if you just want the git repo:
``
git clone git@gitlab.com:philbooth/tryer.git
If you are running in
Node.js
or another CommonJS-style
environment,
you can require
tryer like so:
`javascript`
const tryer = require('tryer');
It also the supports
the AMD-style format
preferred by Require.js.
If you are
including tryer
with an HTML