加载中...

@readonly


描述:标记为只读的。

概述

标记一个标识符为只读。jsdoc不会检查某个代码是否真是只读的,只要标上@readonly,在文档中就体现为只读的。

例子

例如,使用@readonly标签:

  1. /**
  2. * A constant.
  3. * @readonly
  4. * @const {number}
  5. */
  6. const FOO = 1;

例如,给getter标记为只读:

  1. /**
  2. * Options for ordering a delicious slice of pie.
  3. * @namespace
  4. */
  5. var pieOptions = {
  6. /**
  7. * Plain.
  8. */
  9. plain: 'pie',
  10. /**
  11. * A la mode.
  12. * @readonly
  13. */
  14. get aLaMode() {
  15. return this.plain + ' with ice cream';
  16. }
  17. };

还没有评论.