Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

every and each unmounting...

未关闭
#395 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
ruby
领域
frontend

调研方向

从 Observable 的 AutoUnmount 行为以及 issue 中提到的 Browser::Interval 和 Browser::Delay 类开始。检查 every、each、every! 和 each! 当前如何处理卸载,然后确定应实现所提议的哪些语义以及哪种 override 行为。选定的计时器生命周期行为保持一致,并由项目的相关测试覆盖,即视为完成。

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

描述

discussion enhancement

every makes sense, as the timer will keep running for ever. But should any each timer that is still running when things unmount also be unmounted? Note that Observable includes AutoUnmount, so any store will get this behavior as well!

Then, on the other hand, there is an each! and every! method (they don't auto start, so you have to say each!(x).start. Neither of these timers IS auto-unmounted.

Couple of options:

  1. just take after out of unmount, and forgettabout it.
  2. 1 + provide a remove_after_timers method callable in Observable
  3. leave it, and if you want a timer that isn't unmounted use the bang variation.
  4. provide auto_unmount(x) attached to the timers so you say: after(12).auto_unmount(true) or every(12).auto_unmount(false) to override the defaults.

Currently I think its best to make both every and every! behave the same, and make each and each! not autounmount, and then add the auto_unmount method to the Browser::Interval and Browser::Delay classes.

  attr_accessor :mount_point

  def auto_unmount(yes)
     # warning message  and return if mount_point is nil
     if yes 
      AutoUnmount.objects_to_unmount[mount_point] << self 
     else
      AutoUnmount.objects_to_unmount[mount_point].delete(self)
    end
  end

  alias unmount abort

now all the automounter does is set mount_point

     def every!(*args, &block)
        super.tap do |id| 
           next id if unmounted?
           id.mount_point = self
           id.auto_unmount(true)
         end
      end
      def after!(*args, &block)
        super.tap { |id| id.mount_point = self unless unmounted? }
      end
主要语言
JavaScript
星标
538
派生
41
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

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

hyperstack-org/hyperstack 的其他 Issue

查看 hyperstack-org/hyperstack 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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