YAMAMOTO Yuji (山本悠滋)
2026-11-22 JSConf JP 2026
postMessage というブラウザーの API や、postMessage とは?postMessage でオブジェクトをやり取りしようpostMessage でオブジェクトをやり取りしようpostMessage によるオブジェクトのやり取りの仕組みWasm Component Model って?:
componentize-py
で Wasm Component を作り、jco で ESM
に変換する:
実行例:
結果:
*️⃣このスライドにおける定義
*️⃣これもこのスライドにおける定義
プログラム(と、そのパーツ。スレッドやモジュール)がアクセスできるメモリー内のデータの集まり
postMessage における所有権の移動 (1)<html>
<script>
// メインスレッド
const worker = new Worker("worker.js");
const array = new Uint8Array([1, 2, 3]);
// ここで `array` の所有権を `worker` に移動させる
worker.postMessage(array, [array.buffer]);
console.log(array); // ← ここでエラー!
</script>
....https://developer.mozilla.org/ja/docs/Web/API/Web_Workers_API/Transferable_objects
ArrayBufferとかMessagePortとか、OffscreenCanvasとかhttps://share.google/aimode/vaK8RnKezhQ7bTETR
JSによるWasmコンポーネント作りの参考に: - ComponentizeJS/EXAMPLE.md at main · bytecodealliance/ComponentizeJS
所有権を侵害したやり取りのシミュレーションに - Proxy - JavaScript | MDN
resource構文ownとborrowの違いhttps://github.com/WebAssembly/component-model/blob/main/design/high-level/Choices.md