Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
7 results across 6 corpora for Uint8Array.
Encyclopedia 1
ECMAScript version history
o use the rawJSON record when available, allowing round-tripping of JSON data. Iterator sequencing: Iterator.concat( ...items ) , which concatenates iterators. Uint8Array to/from base64 and hex. Math.sumPrecise , a correctly-rounded floating-point summation function analogous to Python's math.fsum . Error.isError Array.fromAsync : similar in concept to Array.from , but acts on async iterators. Corresponds to for awai
Developer library 6
init: Wasm memory instruction
g(fetch("{%wasm-url%}")).then((result) => { result.instance.exports.init(); const memBuffer = result.instance.exports.memory.buffer; const memArray = new Uint8Array(memBuffer, 0, 11); console.log(new TextDecoder().decode(memArray)); }); ``` In the above example, we specify a `data` definition with the identifier `$greeting`, containing the string "Hello World". In the `init()` function, the `data` segment is
fill: Wasm memory instruction
g(fetch("{%wasm-url%}")).then((result) => { result.instance.exports.fill(); const memBuffer = result.instance.exports.memory.buffer; const memArray = new Uint8Array(memBuffer, 0, 6); console.log(memArray[5]); }); ``` In the above example, we define an exported memory called `$my_mem` with a maximum size of one page. We then include an exported `fill()` function that fills the first six bytes of `$my_mem` wit
copy: Wasm memory instruction
g(fetch("{%wasm-url%}")).then((result) => { result.instance.exports.copy(); const memBuffer = result.instance.exports.memory.buffer; const memArray = new Uint8Array(memBuffer, 0, 11); console.log(new TextDecoder().decode(memArray)); }); ``` In the above example, we define an exported memory called `$memory1` with a maximum size of one page. We then include: - A [`data`](/docs/WebAssembly/Reference/Definitio
WebAssembly.Memory.prototype.grow()
w`, will yield an `ArrayBuffer` with the correct length. ```js example-bad const memory = new WebAssembly.Memory({ initial: 1, }); const oldMemoryView = new Uint8Array(memory.buffer); memory.grow(1); // the array is empty! console.log(oldMemoryView); // Uint8Array [] ``` ```js example-good const memory = new WebAssembly.Memory({ initial: 1, }); memory.grow(1); const currentMemoryView = new Uint8Array(memory.buf
drop: Wasm data instruction
g(fetch("{%wasm-url%}")).then((result) => { result.instance.exports.init(); const memBuffer = result.instance.exports.memory.buffer; const memArray = new Uint8Array(memBuffer, 0, 5); console.log(new TextDecoder().decode(memArray)); }); ``` In the above example, we define a `memory` and a `data` called `$greeting` that contains the string `Hello`. We then invoke `memory.init` to copy the string over to the `m
data: Wasm definition
g(fetch("{%wasm-url%}")).then((result) => { result.instance.exports.init(); const memBuffer = result.instance.exports.memory.buffer; const memArray = new Uint8Array(memBuffer, 0, 11); console.log(new TextDecoder().decode(memArray)); }); ``` In the above example, we specify two `data` definitions with identifiers `$greeting1` and `$greeting2`, containing the strings "Hello " and "World", respectively. The fir