mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
- Compile scene hierarchies, synchronized rotations, and perspective camera transforms. - Support box and buffer geometry, bounds, normals, and index selection. - Preserve JavaScript constructor and callback behavior in native LLVM and WASM builds.
19 lines
786 B
JavaScript
19 lines
786 B
JavaScript
class Position { constructor(x) { this.x = x; } }
|
|
class Scene {
|
|
constructor(value) {
|
|
Object.defineProperties(this, {
|
|
position: { value, enumerable: true, configurable: true },
|
|
hidden: { value: new Position(3) },
|
|
});
|
|
}
|
|
}
|
|
const position = new Position(1);
|
|
const scene = new Scene(position);
|
|
console.log(scene.position === position, scene.hidden.x, Object.keys(scene).join(','));
|
|
position.x = 2;
|
|
console.log(scene.position.x);
|
|
const descriptor = Object.getOwnPropertyDescriptor(scene, 'position');
|
|
console.log(descriptor.value === position, descriptor.writable, descriptor.enumerable, descriptor.configurable);
|
|
// @ts-expect-error JavaScript typeof permits an unresolvable reference.
|
|
console.log(typeof scriptcMissingHostGlobal, typeof (scriptcMissingHostGlobal));
|