mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +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
17 lines
563 B
JavaScript
17 lines
563 B
JavaScript
class Vector {
|
|
/** @param {number[]} [target] @param {number} [offset] */
|
|
write(target = [], offset = 0) {
|
|
target[offset] = 1;
|
|
target[offset + 1] = 2;
|
|
target[offset + 2] = 3;
|
|
return target;
|
|
}
|
|
}
|
|
const vector = new Vector();
|
|
const typed = new Float64Array(4);
|
|
console.log(vector.write(typed, 1) === typed, typed.join(','));
|
|
const ordinary = [9];
|
|
console.log(vector.write(ordinary) === ordinary, ordinary.join(','), vector.write().join(','));
|
|
const detached = vector.write;
|
|
console.log(detached.call(vector, typed) === typed, typed.join(','));
|