baconjs/bacon.js — pull request #310 by mileskin (2014-01-10 01:24:16+00:00)
Title: Bacon.retry with convenience friends

We've had these for several months now in the project I'm working on, and the API is quite settled. Especially with ajax requests it's really handy to be able to retry conditionally. However, `Bacon.retry` is by no means ajax specific.

Example usage with jQuery ajax:

```coffeescript
Bacon.retry
source: Bacon.fromPromise($.ajax(...))
retries: 2
interval: 5000
isRetryable: (response) -> response.status isnt 401
```

So what do you guys think, would it be generic enough to have this in the core? I would love to hear your feedback and would be happy to change the code if necessary.

One thing concerning the spec: is there a reason why error content can't be asserted at the moment, e.g. `[1, 2, error(foo: 'bar')]`? I tried changing [.toValue in SpecHelper](https://github.com/baconjs/bacon.js/blob/master/spec/SpecHelper.coffee#L213) but only got a bunch of failing tests. I think it would be neat to have assertable errors whether this PR gets merged or not. Any thoughts?