AGENT SKILL

wasm

WebAssembly for high-performance browser code execution

License 许可
MIT
最近更新
2026-03-01
Stars
★ 3
Forks
2

01 前言 Front Matter

name
wasm
license
MIT
metadata
{ "audience": "developers", "category": "web-development" }
description
WebAssembly for high-performance browser code execution
compatibility
opencode

03 SKILL.md 正文

What I do

  • Write WebAssembly modules
  • Use Rust/AssemblyScript for WASM
  • Integrate WASM in web apps
  • Optimize performance-critical code

When to use me

When needing near-native performance in browsers.

Rust to WASM

#[no_mangle]
pub extern "C" fn add(a: i32, b: i32) -> i32 {
    a + b
}
// Load WASM
const wasm = await WebAssembly.instantiateStreaming(
  fetch('add.wasm')
);
wasm.instance.exports.add(1, 2); // 3

JavaScript WASM Loading

async function loadWasm(url) {
  const response = await fetch(url);
  const buffer = await response.arrayBuffer();
  const wasm = await WebAssembly.instantiate(buffer);
  return wasm.instance.exports;
}

04 同仓库更多 Skills