/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/core/examples/wasm.js
27 строк
753 B
Bartek Iwańczuk
chore: merge deno_core repo into main repo (#32353)
27 фев 2026, 21:25
Не верифицирован
27 фев 2026, 21:25
ad52a9f
Код
Авторство
О чём код?
// Copyright 2018-2026 the Deno authors. MIT license. const { ops } = Deno.core; // The Wasm module is generated using assemblyscript@0.24.1 // asc core/examples/wasm.ts --exportStart --initialMemory 6400 -O -o core/examples/wasm.wasm const bytes = ops.op_get_wasm_module(); const module = new WebAssembly.Module(bytes); const instance = new WebAssembly.Instance(module, { wasm: ops }); ops.op_set_wasm_mem(instance.exports.memory); instance.exports.call(); const memory = instance.exports.memory; const view = new Uint8Array(memory.buffer); if (view[0] !== 69) { throw new Error("Expected first byte to be 69"); } instance.exports.call_mem(instance.exports.memory); if (view[0] !== 68) { throw new Error("Expected first byte to be 68"); }