Improve `AddEventListenerOptions` docs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 38/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- documentation, tooling
调研方向
定位 AddEventListenerOptions 接口的生成器输入和输出,然后对比附近有文档的接口,以了解注释如何传播到生成的声明中。通过项目已确立的源添加所提供的文档,并验证生成的输出包含该文档且相关检查均通过。
由索引模型根据 Issue 内容生成。
描述
I spent 10 minutes and couldn't figure out how to add these docs to the generated output, so here's a recommended declaration from the Deno repo:
/**
* Specifies characteristics about the event listener or the event handler it can invoke.
*
* This interface extends `EventListenerOptions` and provides additional configuration
* options for controlling event listener behavior.
*
* @example
* ```ts
* target.addEventListener('message', handler, {
* once: true,
* passive: true,
* signal: controller.signal
* });
* ```
*/
/**
* Options that can be specified when adding an event listener via `addEventListener`.
*
* This interface extends `EventListenerOptions` and provides additional configuration
* options for controlling event listener behavior in a worker context.
*
* @example
* ```ts
* // Register a message event handler that automatically removes itself after one invocation
* worker.addEventListener('message', handleMessageOnce, { once: true });
*
* // Register a message event handler that doesn't block the runtime while processing events
* worker.addEventListener('message', handleMessage, { passive: true });
*
* // Register a message event handler that can be removed via an AbortController
* const controller = new AbortController();
* worker.addEventListener('message', handleMessage, { signal: controller.signal });
*
* // Later, to remove the listener:
* controller.abort();
* ```
*/
interface AddEventListenerOptions extends EventListenerOptions {
/**
* When set to true, the listener will be automatically removed after being invoked once.
* If not specified, defaults to false.
*/
once?: boolean;
/**
* When set to true, indicates that the function specified by the listener will never call
* `preventDefault()`. This allows optimization of the processing of events.
* If a passive listener does try to call `preventDefault()`, it will be ignored.
*/
passive?: boolean;
/**
* An `AbortSignal` that can be used to remove the event listener by calling `abort()`
* on the controller that created the signal.
*
* @example
* ```ts
* const controller = new AbortController();
* target.addEventListener('mousemove', handler, { signal: controller.signal });
*
* // Later, to remove the listener:
* controller.abort();
* ```
*/
signal?: AbortSignal;
}
I can contribute it if someone points out how to add this or feel free to go ahead and add it.
- 主要语言
- TypeScript
- 星标
- 740
- 派生
- 474
- 平均合并
- 3 天 7 小时
- 30 天内合并 PR
- 14
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TypeScript-DOM-lib-generator 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · 6 条评论 ·
维护者通常 1 天内回复
-
lib.d.ts bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2485 ·
维护者通常 1 天内回复
-
lib.d.ts bug
难度 1/5 1 小时以内 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · 1 个 reaction ·
维护者通常 1 天内回复
-
lib.d.ts bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · 5 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#1675 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 microsoft/TypeScript-DOM-lib-generator 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
Doist/todoist-cli#576 ·
维护者通常 1 天内回复
-
🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
CopilotKit/aimock#491 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
agilepathway/label-checker#710 · 2 条评论 ·
维护者通常 1 天内回复