Upgrade to Pro — share decks privately, control downloads, hide ads and more …

はじめてのWebAssembly

 はじめてのWebAssembly

Nihonbashi.js #1の資料です。

Kazuki Shibata

May 18, 2017
Tweet

More Decks by Kazuki Shibata

Other Decks in Technology

Transcript

  1. function AddFunctions(){ "use asm"; function add1(value){ value = value |

    0; // Ҿ਺͸ int ͩͱ໌ࣔ var result = 0; // int ͱͯ͠એݴ
 result = (value + 1) | 0; // int ΁Ωϟετ return result; } return { add1: add1 } }
  2. )5.-ͷத਎ <script> var Module = {} fetch('index.wasm') .then((response) => response.arrayBuffer())

    .then((buffer) => { Module.wasmBinary = buffer; var script = document.createElement('script'); script.src = 'index.js'; document.body.appendChild(script); }) </script>