Post has been deleted
·
Across the Great Wall, we can reach every corner in the world.

你的目的是配置更改的时候通知 APP 做相应动作(配置监听),但通常配置更改都会触发很多动作,如果写成:

set prop(state: boolean) {
  this._prop = state
  this._app.respond()
}

后面有其他应用也需要监听配置变化,set prop 里面的逻辑就会很乱,最后变成 shit ,写成 listener 能够无限拓展,且不依赖其他功能。

Replies
1