esdoc / esdoc

ESDoc - Good Documentation for JavaScript
https://esdoc.org
MIT License
2.74k stars 204 forks source link

Object.defineProperty #485

Closed robertmain closed 6 years ago

robertmain commented 6 years ago

Make sure these boxes are checked before submitting your issue - thank you! (If your issue is neither a both bug nor a request, please write in a free style)

Short summary of your issue

It strikes me as it would be useful to be able to somehow document properties added with Object.defineProperty(see below). I tried declaring the property just before the call to Object.defineProperty but I think it may throw an error(though I haven't tested it yet)

Input data for reproducing

Configuration

{
    "source":"./src",
    "destination":"./docs",
    "includes":[
        "\\.js$"
    ],
    "excludes":[
        "\\uint32.js$"
    ],
    "plugins":[
        {
            "name":"esdoc-standard-plugin",
            "option":{
                "lint":{
                    "enable":true
                },
                "coverage":{
                    "enable":true
                },
                "accessor":{
                    "access":[
                        "public",
                        "protected",
                        "private"
                    ],
                    "autoPrivate":true
                },
                "undocumentIdentifier":{
                    "enable":true
                },
                "unexportedIdentifier":{
                    "enable":false
                },
                "typeInference":{
                    "enable":true
                }
            }
        },
        {
            "name": "esdoc-node"
        }
    ]
}

Code

/**
 * Context
 * 
 * @class Context
 */
class Context {

    /**
     * Creates a new pure image Context
     * 
     * @param {Bitmap} bitmap An instance of the {@link Bitmap} class
     * @memberof Context
     */
    constructor(bitmap) {
        /**
         * @type {Bitmap}
         */
        this.bitmap = bitmap;

        /**
         * @type {number}
         */
        this._fillColor = 0x000000FF;
        Object.defineProperty(this, 'fillStyle', {
            get: function() { return this._fillStyle_text; },
            set: function(val) {
                this._fillColor = Context.colorStringToUint32(val);
                /**
                 * @type {string}
                 */
                this._fillStyle_text = val;
            }
        });
    }
}

Output data

Log

n/a

Screen shot of documentation

// attach a image into here

Exception output (if possible)

Log

// write into here

Screen shot of documentation

// attach a image into here

Your environment

robertmain commented 6 years ago

Closing as duplicate of #410