简体   繁体   English

如何使用jsdoc3记录Web组件

[英]How to document an web component with jsdoc3

What would be the way to document a web component using jsdoc3 使用jsdoc3记录Web组件的方式是什么

Here is an example of web component registered with x-tag. 这是向x-tag注册的Web组件的示例。

xtag.register('x-analytics',
{
    lifecycle : {
        created : function(){
        }
    },
    accessors : {
        code : {
            attribute : true
        },
        domain : {
            attribute : true
        }
    }
});

Since X-Tag is also just JavaScript, you can simply use the corresponding annotations provided by jsdoc. 由于X-Tag也是JavaScript,因此您可以简单地使用jsdoc提供的相应注释。 So things like @memberof etc. 所以像@memberof

However, Web Components syntax can have its own kind of additional meaning. 但是,Web组件语法可以具有其自身的其他含义。 For example you probably want an annotation for @element or @lifecycleCallback and stuff like this. 例如,您可能想要@element@lifecycleCallback的注释以及类似的内容。 This is not provided by jsdoc and therefore eg Polymer uses it's own documentation annotation using core-component-page . 这不是jsdoc提供的,因此例如Polymer使用了它自己的文档注释,即core-component-page

You either use what jsdoc provides and see what annotations fit best for your use case, or you use something like dgeni which lets you build a documentation tool pipe entirely from scratch, so you have full control over your annotations etc. 您可以使用jsdoc提供的功能,并查看最适合您的用例的注释,或者使用dgeni之类的东西 ,它使您可以完全从头开始构建文档工具管道,从而可以完全控制注释等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM