Skip to content

Commit e6e0a93

Browse files
committed
document Closure syntax for private and protected tags (#62)
1 parent 037d118 commit e6e0a93

File tree

5 files changed

+80
-25
lines changed

5 files changed

+80
-25
lines changed

Diff for: content/en/tags-private.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,38 @@ tag: private
33
description: This symbol is meant to be private.
44
related:
55
- tags-access.html
6+
- tags-global.html
67
- tags-instance.html
78
- tags-protected.html
89
- tags-public.html
910
- tags-static.html
10-
- tags-global.html
1111
---
1212

13+
## Syntax
14+
15+
With the JSDoc tag dictionary (enabled by default):
16+
17+
`@private`
18+
19+
With the [Closure Compiler] tag dictionary:
20+
21+
`@private [{typeExpression}]`
22+
23+
1324
## Overview
1425

15-
The @private tag marks a symbol as private, or not meant for general use. Private members are not
16-
shown in the generated output unless JSDoc is run with the `-p` or `--private` switch.
26+
The `@private` tag marks a symbol as private, or not meant for general use. Private members are not
27+
shown in the generated output unless JSDoc is run with the `-p/--private` command-line option. In
28+
JSDoc 3.3.0 and later, you can also use the [`-a/--access` command-line option][access-option] to
29+
change this behavior.
1730

18-
The @private tag is not inherited by child members. For example, if the @private tag is added to a
19-
namespace, members of the namespace can still appear in the generated output; because the namespace
20-
is private, the members' namepath will not include the namespace.
31+
The `@private` tag is not inherited by child members. For example, if the `@private` tag is added to
32+
a namespace, members of the namespace can still appear in the generated output; because the
33+
namespace is private, the members' namepath will not include the namespace.
2134

22-
The @private tag is equivalent to "@access private". See [@access][access-tag] for details about the
23-
@access tag.
35+
The `@private` tag is equivalent to `@access private`.
2436

25-
[access-tag]: tags-access.html
37+
[access-option]: about-commandline.html
2638

2739

2840
## Examples

Diff for: content/en/tags-protected.md

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
tag: protected
3-
description: This member is meant to be protected.
3+
description: This symbol is meant to be protected.
44
related:
55
- tags-access.html
66
- tags-global.html
@@ -10,17 +10,36 @@ related:
1010
- tags-static.html
1111
---
1212

13+
## Syntax
14+
15+
With the JSDoc tag dictionary (enabled by default):
16+
17+
`@protected`
18+
19+
With the [Closure Compiler] tag dictionary:
20+
21+
`@protected [{typeExpression}]`
22+
23+
1324
## Overview
1425

15-
This tag marks a doclet as protected.
26+
The `@protected` tag marks a symbol as protected. Typically, this tag indicates that a symbol is
27+
only available, or should only be used, within the current module.
1628

17-
Note that "@protected" is equivalent to "@access protected". See [@access][access-tag] for details.
29+
By default, symbols marked with the `@protected` tag will appear in your documentation. In JSDoc
30+
3.3.0 and later, you can use the [`-a/--access` command-line option][access-option] to change this
31+
behavior.
1832

19-
[access-tag]: tags-access.html
33+
The `@protected` tag is equivalent to `@access protected`.
34+
35+
[access-option]: about-commandline.html
2036

2137

2238
## Examples
2339

40+
In the following example, the instance member `Thingy#_bar` appears in the generated documentation,
41+
but with an annotation indicating that it is protected:
42+
2443
{% example "Using the @protected tag" %}
2544

2645
```js

Diff for: index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ <h2 id="block-tags">Block Tags</h2>
143143
<dt><a href="tags-property.html">@property</a> (synonyms: @prop)</dt>
144144
<dd>Document a property of an object.</dd>
145145
<dt><a href="tags-protected.html">@protected</a></dt>
146-
<dd>This member is meant to be protected.</dd>
146+
<dd>This symbol is meant to be protected.</dd>
147147
<dt><a href="tags-public.html">@public</a></dt>
148148
<dd>This symbol is meant to be public.</dd>
149149
<dt><a href="tags-readonly.html">@readonly</a></dt>

Diff for: tags-private.html

+18-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
<h1>@private</h1>
2525
<h2>Table of Contents</h2>
2626
<ul>
27+
<li>
28+
<a href="#syntax">Syntax</a>
29+
</li>
2730
<li>
2831
<a href="#overview">Overview</a>
2932
</li>
@@ -34,12 +37,19 @@ <h2>Table of Contents</h2>
3437
<a href="#related-links">Related Links</a>
3538
</li>
3639
</ul>
40+
<h2 id="syntax">Syntax</h2>
41+
<p>With the JSDoc tag dictionary (enabled by default):</p>
42+
<p><code>@private</code>
43+
</p>
44+
<p>With the [Closure Compiler] tag dictionary:</p>
45+
<p><code>@private [{typeExpression}]</code>
46+
</p>
3747
<h2 id="overview">Overview</h2>
38-
<p>The @private tag marks a symbol as private, or not meant for general use. Private members are not shown in the generated output unless JSDoc is run with the
39-
<code>-p</code> or <code>--private</code> switch.</p>
40-
<p>The @private tag is not inherited by child members. For example, if the @private tag is added to a namespace, members of the namespace can still appear in the
41-
generated output; because the namespace is private, the members&#39; namepath will not include the namespace.</p>
42-
<p>The @private tag is equivalent to &quot;@access private&quot;. See <a href="tags-access.html">@access</a> for details about the @access tag.</p>
48+
<p>The <code>@private</code> tag marks a symbol as private, or not meant for general use. Private members are not shown in the generated output unless JSDoc is
49+
run with the <code>-p/--private</code> command-line option. In JSDoc 3.3.0 and later, you can also use the <a href="about-commandline.html"><code>-a/--access</code> command-line option</a> to change this behavior.</p>
50+
<p>The <code>@private</code> tag is not inherited by child members. For example, if the <code>@private</code> tag is added to a namespace, members of the namespace
51+
can still appear in the generated output; because the namespace is private, the members&#39; namepath will not include the namespace.</p>
52+
<p>The <code>@private</code> tag is equivalent to <code>@access private</code>.</p>
4353
<h2 id="examples">Examples</h2>
4454
<p>In the following example, <code>Documents</code> and <code>Documents.Newspaper</code> appear in the generated documentation, but not <code>Documents.Diary</code>.</p>
4555
<figure>
@@ -62,6 +72,9 @@ <h2 id="related-links">Related Links</h2>
6272
<li>
6373
<a href="tags-access.html">@access</a>
6474
</li>
75+
<li>
76+
<a href="tags-global.html">@global</a>
77+
</li>
6578
<li>
6679
<a href="tags-instance.html">@instance</a>
6780
</li>
@@ -74,9 +87,6 @@ <h2 id="related-links">Related Links</h2>
7487
<li>
7588
<a href="tags-static.html">@static</a>
7689
</li>
77-
<li>
78-
<a href="tags-global.html">@global</a>
79-
</li>
8090
</ul>
8191
</article>
8292
<footer>

Diff for: tags-protected.html

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<head>
66
<meta charset="utf-8">
7-
<meta name="description" content="This member is meant to be protected.">
7+
<meta name="description" content="This symbol is meant to be protected.">
88
<title>Use JSDoc: @protected</title>
99
<link rel="stylesheet" href="styles/usejsdoc.css">
1010
<link rel="stylesheet" href="styles/prettify.css">
@@ -24,6 +24,9 @@
2424
<h1>@protected</h1>
2525
<h2>Table of Contents</h2>
2626
<ul>
27+
<li>
28+
<a href="#syntax">Syntax</a>
29+
</li>
2730
<li>
2831
<a href="#overview">Overview</a>
2932
</li>
@@ -34,10 +37,21 @@ <h2>Table of Contents</h2>
3437
<a href="#related-links">Related Links</a>
3538
</li>
3639
</ul>
40+
<h2 id="syntax">Syntax</h2>
41+
<p>With the JSDoc tag dictionary (enabled by default):</p>
42+
<p><code>@protected</code>
43+
</p>
44+
<p>With the [Closure Compiler] tag dictionary:</p>
45+
<p><code>@protected [{typeExpression}]</code>
46+
</p>
3747
<h2 id="overview">Overview</h2>
38-
<p>This tag marks a doclet as protected.</p>
39-
<p>Note that &quot;@protected&quot; is equivalent to &quot;@access protected&quot;. See <a href="tags-access.html">@access</a> for details.</p>
48+
<p>The <code>@protected</code> tag marks a symbol as protected. Typically, this tag indicates that a symbol is only available, or should only be used, within the
49+
current module.</p>
50+
<p>By default, symbols marked with the <code>@protected</code> tag will appear in your documentation. In JSDoc 3.3.0 and later, you can use the <a href="about-commandline.html"><code>-a/--access</code> command-line option</a> to change this behavior.
51+
</p>
52+
<p>The <code>@protected</code> tag is equivalent to <code>@access protected</code>.</p>
4053
<h2 id="examples">Examples</h2>
54+
<p>In the following example, the instance member <code>Thingy#_bar</code> appears in the generated documentation, but with an annotation indicating that it is protected:</p>
4155
<figure>
4256
<figcaption>Using the @protected tag</figcaption><pre class="prettyprint lang-js"><code>/** @constructor */
4357
function Thingy() {

0 commit comments

Comments
 (0)