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

Reflect 对象创建目的? #70

Open
LuckyWinty opened this issue Aug 5, 2020 · 1 comment
Open

Reflect 对象创建目的? #70

LuckyWinty opened this issue Aug 5, 2020 · 1 comment
Labels

Comments

@LuckyWinty
Copy link
Owner

No description provided.

@LuckyWinty
Copy link
Owner Author

  1. 将 Object 对 象 的 一 些 明 显 属 于 语 言 内 部 的 方 法 ( 比 如 Object.defineProperty,放到 Reflect 对象上。
  2. 修改某些 Object 方法的返回结果,让其变得更合理。
  3. 让 Object 操作都变成函数行为。
  4. Reflect 对象的方法与 Proxy 对象的方法一一对应,只要是 Proxy 对象 的方法,就能在 Reflect 对象上找到对应的方法。这就让 Proxy 对象可 以方便地调用对应的 Reflect 方法,完成默认行为,作为修改行为的基础。

也就是说,不管 Proxy 怎么修改默认行为,你总可以在 Reflect 上获取 默认行为。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant