Skip to content

Commit

Permalink
use it in doAmazingness example
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Dec 6, 2021
1 parent 748e15c commit 0645ef6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,11 +1695,9 @@ controller.abort();</code></pre>

<pre><code class=lang-javascript>
function doAmazingness({signal}) {
if (signal.aborted) {
return Promise.reject(signal.reason);
}

return new Promise((resolve, reject) => {
signal.throwIfAborted();

// Begin doing amazingness, and call resolve(result) when done.
// But also, watch for signals:
signal.addEventListener('abort', () => {
Expand Down

0 comments on commit 0645ef6

Please sign in to comment.