How can I use RxJs to hold off any requests for an AJAX call until the previous one resolves
- 阅读更多 关于 How can I use RxJs to hold off any requests for an AJAX call until the previous one resolves
问题 I have an observable that represents an action that is triggered by some outside component. For the purpose of this question, let's call it createBananaAction . I have a bananaService with a method create that performs an AJAX request and returns the created banana as a Promise . So, whenever some data arrives from the createBananaAction , we want to call bananaService.create() . The code looks like this: (using RxJs) this.createdBananas = createBananaAction.flatMap(() => bananaService.create