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
Return proxy from constructor further up the prototype chain
The change ensures the this object used in methods is the proxy from the
very beginning. This solves pretty much all issues with returning the
proxy from a constructor. For example, private fields can be used now.
More details available at:
tj#1921 (comment)
Additionally, wrong spelling has been fixed in comments.
// The proxy only treats keys not present in the instance and its prototype chain as keys for _optionValues when _storeOptionsAsProperties is set to true.
20
+
// Setting option values for keys present in the instance and its prototype chain is still possible by calling .setOptionValue() or .setOptionValueWithSource(),
21
+
// but such values will not be accessible as instance properties because the instance and its prototype chain have precedence.
22
+
// However, they will be accessible via .getOptionValue(), .opts() and .optsWithGlobals().
// Because of how the returned proxy works, ideally, no prooerties should be defined outside the cinstructor.
116
-
// They can still be defined outside the constructor in subclasses, but only when _storeOptionsAsProperties is set to false.
117
-
this._version=undefined;
118
-
this._versionOptionName=undefined;
119
-
120
-
// The proxy only treats keys not present in the instance and its prototype chain as keys for _optionValues when _storeOptionsAsProperties is set to true.
121
-
// Setting option values for keys present in the instance and its prototype chain is still possible by calling .setOptionValue() or .setOptionValueWithSource(),
122
-
// but such values will not be accessible as instnace properties because the instance and its prototype chain has precedence.
123
-
// However, they will be accessible via .getOptionValue(), .opts() and .optsWithGlobals().
0 commit comments