Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 注册的设计 #1

Open
harttle opened this issue Apr 11, 2018 · 0 comments
Open

API 注册的设计 #1

harttle opened this issue Apr 11, 2018 · 0 comments

Comments

@harttle
Copy link
Collaborator

harttle commented Apr 11, 2018

Sandbox 只实现核心的声明周期,以及通用工具(比如托管一个回调,以及不同的托管策略)。具体的 API 采取动态注册的方式,有利于后续维护和新增 API。

  • 功能模块自主注册,而非统一设置。因为不同 API 的可读/写性可能不同,不做统一处理自行 defineProperty
  • 按照功能(而非函数)来切分API。使得可以在闭包内管理函数间的共享变量,避免了全局共享数据的情况。例如 addEventListenerremoveEventListener �需要共享事件处理器。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant