EVOLUTION-MANAGER
Edit File: promise_all.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Combine multiple promise objects</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for promise_all {promises}"><tr><td>promise_all {promises}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Combine multiple promise objects</h2> <h3>Description</h3> <p>Use <code>promise_all</code> to wait for multiple promise objects to all be successfully fulfilled. Use <code>promise_race</code> to wait for the first of multiple promise objects to be either fulfilled or rejected. </p> <h3>Usage</h3> <pre> promise_all(..., .list = NULL) promise_race(..., .list = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>Promise objects. Either all arguments must be named, or all arguments must be unnamed. If <code>.list</code> is provided, then these arguments are ignored.</p> </td></tr> <tr valign="top"><td><code>.list</code></td> <td> <p>A list of promise objects–an alternative to <code>...</code>.</p> </td></tr> </table> <h3>Value</h3> <p>A promise. </p> <p>For <code>promise_all</code>, if all of the promises were successful, the returned promise will resolve to a list of the promises' values; if any promise fails, the first error to be encountered will be used to reject the returned promise. </p> <p>For <code>promise_race</code>, the first of the promises to either fulfill or reject will be passed through to the returned promise. </p> <h3>Examples</h3> <pre> p1 <- promise(~later::later(~resolve(1), delay = 1)) p2 <- promise(~later::later(~resolve(2), delay = 2)) # Resolves after 1 second, to the value: 1 promise_race(p1, p2) %...>% { cat("promise_race:\n") str(.) } # Resolves after 2 seconds, to the value: list(1, 2) promise_all(p1, p2) %...>% { cat("promise_all:\n") str(.) } </pre> <hr /><div style="text-align: center;">[Package <em>promises</em> version 1.1.1 <a href="00Index.html">Index</a>]</div> </body></html>