JSDoc 正确记录事件侦听器

JSDoc documenting event listeners properly

我一直在学习如何在我的项目中使用 JSDoc,除了一两件事之外,我基本上了解如何使用它。其中之一是记录事件侦听器。

我看过关于@listens 的文档,但是他们提供的 explanation/example 对我来说没有意义。这是页面的 link:https://jsdoc.app/tags-listens.html

我想知道是否有人有更好的方法向我解释它,或者可以向我展示您如何记录基本事件侦听器的示例。 (我在下面提供一个)

document.getElementById('some_element').addEventListener('mousedown', function () {
  // Some code
});

谢谢

扩展我上面的评论,我认为以下是记录该行代码的可接受方式,其中 document 是命名空间,后跟事件名称 mousedown

/**
 * Listen to mousedown event
 *
 * @type {HTMLElement} - the target of the event
 * @listens document#mousedown - the namespace and name of the event
 */

document.getElementById('some_element').addEventListener('mousedown', function () {
  // Some code
});