mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +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
556 B
JavaScript
15 lines
556 B
JavaScript
class RecordValue {
|
|
constructor(value) { this.value = value; }
|
|
static read(object) { return object.value; }
|
|
static label(object) { return this.read(object) + ":" + this.tag; }
|
|
toJSON() { return this.constructor.label(this); }
|
|
}
|
|
RecordValue.tag = "base";
|
|
class Child extends RecordValue {}
|
|
Child.tag = "child";
|
|
const value = new Child("hello");
|
|
console.log(value.toJSON());
|
|
const read = Child.read;
|
|
console.log(read === RecordValue.read, read({ value: "detached" }));
|
|
console.log(Child.missing === undefined, Child.prototype.constructor === Child);
|