You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -76,13 +76,19 @@ After loading `reflect.js` into your page or other JS environment, be aware that
76
76
Object.prototype.hasOwnProperty
77
77
Object.getOwnPropertyDescriptor
78
78
Object.defineProperty
79
+
Object.defineProperties
79
80
Object.getOwnPropertyNames
80
81
Function.prototype.toString
81
82
Date.prototype.toString
82
83
Array.isArray
83
84
Array.prototype.concat
84
85
Proxy
85
86
87
+
:warning: In node.js, when you `require('harmony-reflect')`, only the current
88
+
module's globals are patched. If you pass an emulated direct proxy to an external module, and that module uses the unpatched globals, the module may not interact with the proxy according to the latest ES6 Proxy API, instead falling
89
+
back on the old pre-ES6 Proxy API. This can cause bugs, e.g. the built-in `Array.isArray` will return `false` when passed a proxy-for-array, while the
90
+
patched `Array.isArray` will return true. I know of no good fix to reliably patch the globals for all node modules. If you do, let me know.
* (7): assuming that `proxy.valueOf`, which triggers the proxy's "get" trap, returned `Object.prototype.valueOf`.
177
182
* (8): assuming that `proxy.toString`, which triggers the proxy's "get" trap, returned `Object.prototype.toString`.
178
183
* (9): the return value of the `getOwnPropertyDescriptor` trap (the property descriptor object) is not the original value returned from the intercepted `Object.getOwnPropertyDescriptor` call. Rather, it is a fresh descriptor object that is guaranteed to be "complete" (i.e. to define values for all relevant ECMAScript property attributes).
179
-
* (10): the third argument to the `defineProperty` trap (the property descriptor object) is not the original value passed into the intercepted `Object.defineProperty` call. Rather, it is a fresh descriptor object that is guaranteed to be "complete" (i.e. to define values for all relevant ECMAScript property attributes).
184
+
* (10): the third argument to the `defineProperty` trap (the property descriptor object) is not the original value passed into the intercepted `Object.defineProperty` call. Rather, it is a fresh descriptor object that is guaranteed to be "complete" (i.e. to define values for all relevant ECMAScript property attributes). For `Object.defineProperties(proxy,props)`, the proxy's `defineProperty` trap is called for each own enumerable property of `props`.
180
185
* (11): only on platforms that support mutable `__proto__` and where `__proto__` is an accessor property defined on `Object.prototype`.
181
186
* (12): the `ownKeys` trap must return all own property names. `Object.keys` then retains only the keys denoting enumerable properties.
0 commit comments