@access¶
-
.. @access::¶ - 语法
@access <package|private|protected|public>- 概述
The
@accesstag specifies the access level of a member. You can use the@accesstag as a synonym for other tags:@access packageis the same as@package. This option is available in JSDoc 3.5.0 and later.@access privateis the same as@private.@access protectedis the same as@protected.@access publicis the same as@public.
Private members are not shown in the generated output unless JSDoc is run with the
-p/--privatecommand-line option. In JSDoc 3.3.0 and later, you can also use the-a/--accessJSDoc的命令行参数 to change this behavior.Note that a doclet’s access level is different from its scope. For example, if
Parenthas an inner variable namedchildthat is documented as@public, thechildvariable will still be treated as an inner variable with the namepathParent~child. In other words, thechildvariable will have an inner scope, even though the variable is public. To change a doclet’s scope, use the@instance,@static, and@globaltags.- 示例
- Using @access as a synonym for other tags¶
/** @constructor */ function Thingy() { /** @access private */ var foo = 0; /** @access protected */ this._bar = 1; /** @access package */ this.baz = 2; /** @access public */ this.pez = 3; } // same as... /** @constructor */ function OtherThingy() { /** @private */ var foo = 0; /** @protected */ this._bar = 1; /** @package */ this.baz = 2; /** @public */ this.pez = 3; }