Content-Length: 509388 | pFad | http://github.com/jsdoc/jsdoc.github.io/commit/dda184335220e78f38f15fb6df2b445e620aba71

EF document async tag (#158) · jsdoc/jsdoc.github.io@dda1843 · GitHub
Skip to content

Commit dda1843

Browse files
committed
document async tag (#158)
1 parent 723546c commit dda1843

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

content/en/tags-async.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
tag: async
3+
description: Indicate that a function is asynchronous.
4+
---
5+
6+
## Syntax
7+
8+
`@async`
9+
10+
11+
## Overview
12+
13+
The `@async` tag indicates that a function is [asynchronous][async-function], meaning that it
14+
was declared using the syntax `async function foo() {}`. Do not use this tag for other types of
15+
asynchronous functions, such as functions that provide a callback. This tag is available in JSDoc
16+
3.5.0 and later.
17+
18+
In general, you do not need to use this tag, because JSDoc automatically detects asynchronous
19+
functions and identifies them in the generated documentation. However, if you are writing a virtual
20+
comment for an asynchronous function that does not appear in your code, you can use this tag to
21+
tell JSDoc that the function is asynchronous.
22+
23+
[async-function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
24+
25+
26+
## Example
27+
28+
The following example shows a virtual comment that uses the `@async` tag:
29+
30+
{% example "Virtual comment with @async tag" %}
31+
32+
```js
33+
/**
34+
* Download data from the specified URL.
35+
*
36+
* @async
37+
* @function downloadData
38+
* @param {string} url - The URL to download from.
39+
* @return {Promise<string>} The data from the URL.
40+
*/
41+
```
42+
43+
{% endexample %}

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ <h2 id="block-tags">Block Tags</h2>
6868
<dd>Specify the access level of this member (private, public, or protected).</dd>
6969
<dt><a href="tags-alias.html">@alias</a></dt>
7070
<dd>Treat a member as if it had a different name.</dd>
71+
<dt><a href="tags-async.html">@async</a></dt>
72+
<dd>Indicate that a function is asynchronous.</dd>
7173
<dt><a href="tags-augments.html">@augments</a> (synonyms: @extends)</dt>
7274
<dd>Indicate that a symbol inherits from, and adds to, a parent symbol.</dd>
7375
<dt><a href="tags-author.html">@author</a></dt>

tags-async.html

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE html>
2+
<!-- THIS IS A GENERATED FILE. DO NOT EDIT. -->
3+
<html lang="en">
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<meta name="description" content="Indicate that a function is asynchronous.">
8+
<title>Use JSDoc: @async</title>
9+
<link rel="stylesheet" href="styles/usejsdoc.css">
10+
<link rel="stylesheet" href="styles/prettify.css">
11+
<link rel="stylesheet" href="styles/css3-github-ribbon.css">
12+
<script src="scripts/prettify.js"></script>
13+
<!--[if lt IE 9]>
14+
<script src="scripts/html5shiv.min.js"></script>
15+
<script src="scripts/html5shiv-printshiv.min.js"></script>
16+
<![endif]-->
17+
</head>
18+
19+
<body>
20+
<header>
21+
<a href="./index.html">@use JSDoc</a>
22+
</header>
23+
<article>
24+
<h1>@async</h1>
25+
<h2>Table of Contents</h2>
26+
<ul>
27+
<li>
28+
<a href="#syntax">Syntax</a>
29+
</li>
30+
<li>
31+
<a href="#overview">Overview</a>
32+
</li>
33+
<li>
34+
<a href="#example">Example</a>
35+
</li>
36+
</ul>
37+
<h2 id="syntax">Syntax</h2>
38+
<p><code>@async</code>
39+
</p>
40+
<h2 id="overview">Overview</h2>
41+
<p>The <code>@async</code> tag indicates that a function is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">asynchronous</a>,
42+
meaning that it was declared using the syntax <code>async function foo() {}</code>. Do not use this tag for other types of asynchronous functions, such as
43+
functions that provide a callback. This tag is available in JSDoc 3.5.0 and later.</p>
44+
<p>In general, you do not need to use this tag, because JSDoc automatically detects asynchronous functions and identifies them in the generated documentation. However,
45+
if you are writing a virtual comment for an asynchronous function that does not appear in your code, you can use this tag to tell JSDoc that the function is
46+
asynchronous.</p>
47+
<h2 id="example">Example</h2>
48+
<p>The following example shows a virtual comment that uses the <code>@async</code> tag:</p>
49+
<figure>
50+
<figcaption>Virtual comment with @async tag</figcaption><pre class="prettyprint lang-js"><code>/**
51+
* Download data from the specified URL.
52+
*
53+
* @async
54+
* @function downloadData
55+
* @param {string} url - The URL to download from.
56+
* @return {Promise&lt;string>} The data from the URL.
57+
*/
58+
</code></pre>
59+
</figure>
60+
</article>
61+
<footer>
62+
<a class="license-badge" href="http://creativecommons.org/licenses/by-sa/3.0/">
63+
<img alt="Creative Commons License" class="license-badge" src="images/cc-by-sa.svg" width="80" height="15" />
64+
</a>
65+
<br> Copyright &#169; 2011-2017 the
66+
<a href="https://github.com/jsdoc3/jsdoc3.github.com/contributors">contributors</a> to the JSDoc 3 documentation project.
67+
<br> This website is <a href="https://github.com/jsdoc3/jsdoc3.github.com">open source</a> and is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
68+
Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.
69+
</footer>
70+
<script type="text/javascript">
71+
prettyPrint();
72+
</script>
73+
</body>
74+
75+
</html>

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jsdoc/jsdoc.github.io/commit/dda184335220e78f38f15fb6df2b445e620aba71

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy