mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Expand static three.js workflows and host integration * Preserve JavaScript class state in static three.js workflows * Preserve inferred JavaScript behavior across static workflows * Preserve inferred callables and native compatibility boundaries * Retain annotated JavaScript factory exports and bootstrap-safe call spreads * Preserve Buffer and child callback identities in static packages * Clarify JavaScript symbol spread support
20 lines
767 B
JavaScript
20 lines
767 B
JavaScript
class Dimensions {
|
|
/** @param {number} width @param {number} height */
|
|
constructor(width, height, depth = 1) {
|
|
const image = { width: width, height, depth };
|
|
this.image = image;
|
|
}
|
|
}
|
|
const omitted = new Dimensions();
|
|
const supplied = new Dimensions(2, 3, 4);
|
|
console.log(omitted.image.width, omitted.image.height, omitted.image.depth);
|
|
console.log(supplied.image.width, supplied.image.height, supplied.image.depth);
|
|
console.log(Object.keys(omitted.image).join(','));
|
|
supplied.image.width = undefined;
|
|
console.log(supplied.image.width, supplied.image.height);
|
|
class Nested {
|
|
/** @param {number} value */
|
|
constructor(value) { this.data = { nested: { value: (value) } }; }
|
|
}
|
|
console.log(new Nested().data.nested.value, new Nested(5).data.nested.value);
|