nodejs / nodejs/node

Remove `Symbol.dispose` integration in `setTimeout` and `setInterval`

未关闭
#58,689 12 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

As part of the [Symbol.dispose] integration, the Timeout return type of setTimeout and setInterval support disposing (https://github.com/nodejs/node/pull/48633). This was stabilized last week (https://github.com/nodejs/node/pull/58467).

I think this integration should be removed, as the web platform setTimeout / setInterval do not support Symbol.dispose and never can, because it returns a number.

This means that folks may start writing new code that is incompatible between browser and Node, just because they use the Symbol.dispose integration here. That would be unfortunate.

It would also cause one more incompatibility between server side platforms with web setTimeout, and Node setTimeout (e.g Cloudflare Workers) (cc @jasnell).

@mcollina said in person that this was made stable recently enough to still remove it.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查 setTimeout 和 setInterval 入口点,以及 PR 48633 和 58467 中关联的更改。确认 Timeout 当前如何公开 Symbol.dispose,并确定浏览器计时器的兼容性要求;完成的标准是移除该集成,同时保留现有的计时器行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
api, backend
Issue 类型
重构
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。