Files
scriptc/tests/corpus/js-dataview-dispatch.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

23 lines
881 B
JavaScript

function write(view) {
view.setUint16("1", 0x1234, true);
view.setInt32(4, -123456, false);
view.setFloat32(8, 1.5, true);
view.setFloat64(12, -2.25, false);
view.setBigInt64(20, "-7", true);
}
function read(view) {
console.log(view.getUint16(1, true), view.getInt32(4), view.getFloat32(8, true), view.getFloat64(12), String(view.getBigInt64(20, true)));
try { view.getUint32(31); } catch (error) { console.log(error.name, error.message); }
try { view.setBigUint64(20, 1); } catch (error) { console.log(error.name, error.message); }
}
const view = new DataView(new ArrayBuffer(36), 2, 32);
write(view);
read(view);
const calls = [];
function order(view) {
try {
view.setUint32({ valueOf() { calls.push("offset"); return -1; } }, { valueOf() { calls.push("value"); return 2; } });
} catch (error) { console.log(error.name, calls.join(",")); }
}
order(view);