22 lines
No EOL
2.6 KiB
HTML
22 lines
No EOL
2.6 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Promise — Ludic</title>
|
||
<meta name="description" content="Combine several Job futures and resolve the group on the main thread.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Promise</span></div>
|
||
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Promise</h1></div>
|
||
<p class="ns-blurb">Combine several <code>Job</code> futures and resolve the group on the main thread. <code>Promise.all</code> succeeds once every member has, <code>Promise.race</code> once the first does; both return an ordinary job handle you poll like any other. For a loading screen, <code>Promise.count_done</code> over the same handles is the bar's numerator and <code>len</code> the denominator, and <code>Promise.all_done</code> is the ready check. Ludic has no closures, so progress is polled rather than chained through a <code>then</code> callback. Build the handle list with <code>new []int</code> + <code>push</code>. Spliced in only when a program mentions <code>Promise.*</code>.</p>
|
||
<div class="ns-methods"><a class="ns-method" href="promise-all.html"><code class="nm-sig">Promise.all(handles) -> Job</code><span class="nm-tip">Succeeds when every member succeeds.</span></a><a class="ns-method" href="promise-race.html"><code class="nm-sig">Promise.race(handles) -> Job</code><span class="nm-tip">Succeeds when the first member does.</span></a><a class="ns-method" href="promise-count_done.html"><code class="nm-sig">Promise.count_done(handles) -> int</code><span class="nm-tip">How many members have resolved.</span></a><a class="ns-method" href="promise-all_done.html"><code class="nm-sig">Promise.all_done(handles) -> bool</code><span class="nm-tip">Have all members resolved?</span></a></div>
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |