简体   繁体   中英

Documenting event listeners with JSDoc

I have this class constructor:

/**
 * @class Game renderer.
 * @exports Renderer
 * @constructor
 * @param {number=} width canvas width. Defaults to 1024.
 * @param {number=} height canvas height. Defaults to 720.
 */
var Renderer = function(width, height) {
    'use strict';

    // more code ...

    document.body.appendChild(this.canvas);
};

How should I document the last line? and if I have event listener? For example:

canvas.onmousemove = function(event) {
  // do something
};

您可以使用JSDOC3 的 @listens标签,:)

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