简体   繁体   中英

How to document an web component with jsdoc3

What would be the way to document a web component using jsdoc3

Here is an example of web component registered with x-tag.

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. So things like @memberof etc.

However, Web Components syntax can have its own kind of additional meaning. For example you probably want an annotation for @element or @lifecycleCallback and stuff like this. This is not provided by jsdoc and therefore eg Polymer uses it's own documentation annotation using 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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