mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-02 02:07:25 +00:00
Add helper for javascript typed arrays
For scalar vector fields, emit an Array helper that returns a typed array view of the underlying bytes buffer.
This commit is contained in:
parent
2f5d7ae645
commit
9d92aeb182
3 changed files with 44 additions and 1 deletions
|
|
@ -105,6 +105,13 @@ function testBuffer(bb) {
|
|||
}
|
||||
assert.strictEqual(invsum, 10);
|
||||
|
||||
var invsum2 = 0;
|
||||
var invArr = monster.inventoryArray();
|
||||
for (var i = 0; i < invArr.length; i++) {
|
||||
invsum2 += invArr[i];
|
||||
}
|
||||
assert.strictEqual(invsum2, 10);
|
||||
|
||||
var test_0 = monster.test4(0);
|
||||
var test_1 = monster.test4(1);
|
||||
assert.strictEqual(monster.test4Length(), 2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue