0

Promisesを使用してモジュールを構築しています。ここでは、複数の urlsで複数の http 呼び出しを行い、応答を解析してから、さらに http 呼び出しを行います。

c = new RSVP.Promise({urls:[]}) //Passing a list of urls
c.then(http_module1) // Call the http module
.then(parsing_module) // Parsing the responses and extract the hyperlinks
.then(http_module2) // Making http requests on the data produced by the parser before.
.then(print_module) // Prints out the responses.

問題は、promise を使用すると、すべての http 要求が行われない限り、モジュールを解析できないことです。それの訳は -Once a promise has been resolved or rejected, it cannot be resolved or rejected again.

独自のバージョンの promise を構築するか、別のアプローチがありますか?

4

2 に答える 2