Files
scriptc/tests/corpus/js-optional-member-call.js
Chris Tate a07998f667 Expand static three.js workflows and host integration (#621)
* 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
2026-10-02 19:56:34 -05:00

21 lines
695 B
JavaScript

function call(options) {
return options?.render?.(4);
}
const host = { value: 3, render(n) { return this.value + n; } };
console.log(call(host), call({}), call(undefined), call(null));
function reference(key, options) {
function Service() {}
Object.setPrototypeOf(Service, { useSync(fn) { return fn(this.key); } });
const init = (name, config) => {
Service.key = name;
Service.render = config?.render;
return Service;
};
return arguments.length ? init(key, options) : init;
}
const service = reference("scene", host);
console.log(service.useSync(name => name.toUpperCase()));
console.log(service.render?.(5));
console.log(reference()("mesh", {}).useSync(name => name));