Skip to content

需要一个与destroy同级的类似recycle的方法供用户实现 #131

Closed
@leeluolee

Description

@leeluolee

destroy 设计失误,即作为生命周期方法,又充当公共方法,并且很多人在扩展destroy方法后忘记使用this.supr 导致 组件没有被回收 (因为大部分自动清理工作是在Regular#destroy中处理)

更改如下:

添加一个destroy的alias $destroy方法,效果与destroy一样, 但是与其它接口风格一致,声明这个接口为Public实例接口

添加一个用户自定义的比如recycle的生命周期函数(与config, init一致), 这个函数会在$destroy内部被调用,用户无需去关心this.supr

原来的使用方式,仍然允许,(可能考虑在检测到用户扩展destroy 给予警告)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions