-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Use Object.assign for constant definitions. #8838
Conversation
Thanks! |
As far as I understand, this pattern: THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.RingGeometry.prototype.constructor=THREE.RingGeometry; Can now be just this... Object.assign( THREE.RingGeometry.prototype, THREE.Geometry.prototype ); Right? |
Unfortunately it's not quite that simple: In case we use this scheme, we get THREE.RingGeometry.prototype.constructor === THREE.RingGeometry &&
THREE.RingGeometry.prototype.__proto__.constructor === Object and not THREE.RingGeometry.prototype.constructor === THREE.RingGeometry &&
THREE.RingGeometry.prototype.__proto__.constructor === THREE.Geometry &&
THREE.RingGeometry.prototype.__proto__.__proto__.constructor === Object . So it's THREE.RingGeometry.prototype =
Object.assign( Object.create( THREE.Geometry.prototype ), {
constructor: THREE.RingGeometry, // else it's THREE.Geometry
/* ... */
} ); . One could change
So that's not really an option for us. You can get around |
I see I see. As usual, thanks a ton for the explanations! |
I had to correct above post; |
See #8824