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
15 lines
521 B
JavaScript
15 lines
521 B
JavaScript
class Track {
|
|
constructor(value = 2) { this.value = value; this.factory = this.create; }
|
|
size() { return this.value; }
|
|
create(multiplier = 1) { return this.size() * multiplier; }
|
|
}
|
|
const tracks = [new Track(), new Track(4)];
|
|
for (const track of tracks) console.log(track.factory(3));
|
|
console.log(tracks[1].factory());
|
|
const dynamic = JSON.parse('{}');
|
|
dynamic.track = tracks[0];
|
|
console.log(dynamic.track.factory(5));
|
|
const shared = tracks[0].factory;
|
|
tracks[1].factory = shared;
|
|
console.log(tracks[1].factory(2));
|