nodejs / nodejs/node

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

Đang mở
#58,689 12 bình luận 8 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xem xét các entry point của setTimeout và setInterval cùng các thay đổi liên quan trong các PR 48633 và 58467. Xác nhận cách Timeout hiện đang expose Symbol.dispose và xác định các yêu cầu tương thích đối với browser timers; công việc được xem là hoàn tất khi loại bỏ integration đó mà vẫn duy trì behavior hiện tại của timer.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
api, backend
Loại issue
Tái cấu trúc
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.