Closed phated closed 10 years ago
@mattpodwysocki just added the code, not sure how to right the tests. See https://github.com/phated/async-done/commit/f4ee74b689351498a89f8f77ee8d21f68b806ad1 for implementation.
I will send a PR for this tomorrow :)
@phated @d10 Change the RxJS code to the following:
if(result && typeof result.subscribe === 'function') {
// assume RxJS observable
result.subscribe(onSuccess, onError);
return;
}
This will assume then we only have one and only one value in the pipeline. Meaning would it be bad if done is called twice? If that's the case that it's bad, we can fix that by doing the following:
if(result && typeof result.subscribe === 'function') {
// assume RxJS observable
result.take(1).subscribe(onSuccess, onError);
return;
}
Landed in https://github.com/phated/async-done/commit/7ccf6dfaf7014761ba0b9e8d5eae434233a29e68 - Thanks @mattpodwysocki and @d10
See: https://gist.github.com/mattpodwysocki/ff72b3f66d871501e576