我有一个重载的切换函数,并且想要使用 JSDoc 记录行为。
如果定义了该值,则窗口状态将设置为 true 参数的布尔值,如果未定义,则窗口状态会切换。我正在寻找这样的东西。
/**
* Set the map window in mobile
* @param {undefined|*} on - toggle or set the window state
* - {undefined} toggles window state
* - {*} set window state
*/
toggleWindow(on) {
if (on === undefined) {
on = !this.state.window;
}
this.setState({ mapWindow: !!on });
}
Run Code Online (Sandbox Code Playgroud)
取自这里:
您需要将每个评论的开头和结尾放在一起,如下所示:
Run Code Online (Sandbox Code Playgroud)/** * DateRange class to store ranges and query dates. * * @constructor * @param {(Moment|Date)} start Start of interval * @param {(Moment|Date)} end End of interval *//** * DateRange class to store ranges and query dates. * * @constructor * @param {!Array} range Array containing start and end dates. *//** * DateRange class to store ranges and query dates. * * @constructor * @param {!String} range String formatted as an IS0 8601 time interval */ function DateRange(start, end) { // ... }
但请注意,构造函数重载并不组合在一起。每个重载仍然会收到完整的成员列表,因此部分文档变得多余。不过,可能可以在模板中修复。
| 归档时间: |
|
| 查看次数: |
7589 次 |
| 最近记录: |