aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/webassembly/index.html
diff options
context:
space:
mode:
authorMasahiro FUJIMOTO <mfujimot@gmail.com>2021-09-14 11:08:23 +0900
committerGitHub <noreply@github.com>2021-09-14 11:08:23 +0900
commit6c82813dfb8eabfec094f1926f898122214b81d9 (patch)
treed0e63933967bf87e5afc5a31681c28b7ddfae9ed /files/ja/web/javascript/reference/global_objects/webassembly/index.html
parent03385cc9f4f157cec2e5fd05f35e6af646055908 (diff)
downloadtranslated-content-6c82813dfb8eabfec094f1926f898122214b81d9.tar.gz
translated-content-6c82813dfb8eabfec094f1926f898122214b81d9.tar.bz2
translated-content-6c82813dfb8eabfec094f1926f898122214b81d9.zip
Global_Objects/WebAssembly を更新 (#2338)
- Markdownに変換 - 2021/09/01 時点の英語版に同期
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/webassembly/index.html')
-rw-r--r--files/ja/web/javascript/reference/global_objects/webassembly/index.html116
1 files changed, 0 insertions, 116 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/webassembly/index.html b/files/ja/web/javascript/reference/global_objects/webassembly/index.html
deleted file mode 100644
index 721d647799..0000000000
--- a/files/ja/web/javascript/reference/global_objects/webassembly/index.html
+++ /dev/null
@@ -1,116 +0,0 @@
----
-title: WebAssembly
-slug: Web/JavaScript/Reference/Global_Objects/WebAssembly
-tags:
- - API
- - JavaScript
- - Namespace
- - Object
- - Reference
- - WebAssembly
-translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly
----
-<div>{{JSRef}}{{SeeCompatTable}}</div>
-
-<p><strong><code>WebAssembly</code></strong> JavaScript オブジェクトは全ての <a href="/ja/docs/WebAssembly">WebAssembly</a> に関連する機能の名前空間として振る舞います。</p>
-
-<p>他のグローバルオブジェクトとは異なり、<code>WebAssembly</code> はコンストラクタではありません (関数オブジェクトではない) 。数学定数、関数の名前空間である {{jsxref("Math")}} や 、国際化コンストラクタと他の言語に依存する関数のための {{jsxref("Intl")}} と同等のものです。</p>
-
-<h2 id="概要">概要</h2>
-
-<p><code>WebAssembly</code> オブジェクトの主な用途は次のとおりです:</p>
-
-<ul>
- <li>{{jsxref("WebAssembly.instantiate()")}} 関数を用いて WebAssembly コードをロードします。</li>
- <li>{{jsxref("WebAssembly.Memory()")}}/{{jsxref("WebAssembly.Table()")}} コンストラクタ経由で新しいメモリやテーブルを生成します。</li>
- <li>{{jsxref("WebAssembly.CompileError()")}}/{{jsxref("WebAssembly.LinkError()")}}/{{jsxref("WebAssembly.RuntimeError()")}} コンストラクタを経由して、WebAssembly で発生するエラーを処理する機能を提供します、</li>
-</ul>
-
-<h2 id="メソッド">メソッド</h2>
-
-<dl>
- <dt>{{jsxref("WebAssembly.instantiate()")}}</dt>
- <dd>WebAssembly コードをコンパイル、インスタンス化するための主要な API で、 <code>Module</code> と、その最初の <code>Instance</code> を返します。</dd>
- <dt>{{jsxref("WebAssembly.instantiateStreaming()")}}</dt>
- <dd>ソースのストリームから直接 WebAssembly モジュールをコンパイル、インスタンス化し、 <code>Module</code> と、その最初の <code>Instance</code> を返します。</dd>
- <dt>{{jsxref("WebAssembly.compile()")}}</dt>
- <dd>{{jsxref("WebAssembly.Module")}} を用いて WebAssembly バイナリコードからコンパイルします。インスタンス化は別ステップとして分離されます。</dd>
- <dt>{{jsxref("WebAssembly.compileStreaming()")}}</dt>
- <dd>ソースのストリームから直接 {{jsxref("WebAssembly.Module")}} にコンパイルします。インスタンス化は別ステップとして分離されます。</dd>
- <dt>{{jsxref("WebAssembly.validate()")}}</dt>
- <dd>WebAssembly バイナリコードの型付き配列を検証し、バイト列が有効な WebAssembly コードか (<code>true</code>) 否か (<code>false</code>) を返します。</dd>
-</dl>
-
-<h2 id="コンストラクタ">コンストラクタ</h2>
-
-<dl>
- <dt>{{jsxref("WebAssembly.Module()")}}</dt>
- <dd>新しい WebAssembly <code>Module</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.Instance()")}}</dt>
- <dd>新しい WebAssembly <code>Instance</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.Memory()")}}</dt>
- <dd>新しい WebAssembly <code>Memory</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.Table()")}}</dt>
- <dd>新しい WebAssembly <code>Table</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.CompileError()")}}</dt>
- <dd>新しい WebAssembly <code>CompileError</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.LinkError()")}}</dt>
- <dd>新しい WebAssembly <code>LinkError</code> オブジェクトを生成します。</dd>
- <dt>{{jsxref("WebAssembly.RuntimeError()")}}</dt>
- <dd>新しい WebAssembly <code>RuntimeError</code> オブジェクトを生成します。</dd>
-</dl>
-
-<h2 id="例">例</h2>
-
-<p>fetch を使用して WebAssembly バイトコードをフェッチした後、{{jsxref("WebAssembly.instantiate()")}} 関数を使用してモジュールをコンパイル、インスタンス化します。その過程で、WebAssembly モジュールに JavaScript の関数をインポートします。このプロミスは解決時に <code><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module">Module</a></code> と <code><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance">Instance</a></code> を含むオブジェクト (<code>result</code>) を渡します。次に、<code>Instance</code> からエクスポートされている <a href="/ja/docs/WebAssembly/Exported_functions">エクスポートされた WebAssembly 関数</a> を呼び出します。</p>
-
-<pre class="brush: js notranslate">var importObject = {
- imports: {
- imported_func: function(arg) {
- console.log(arg);
- }
- }
-};
-
-fetch('simple.wasm').then(response =&gt;
-  response.arrayBuffer()
-).then(bytes =&gt;
-  WebAssembly.instantiate(bytes, importObject)
-).then(result =&gt;
-  result.instance.exports.exported_func()
-);</pre>
-
-<div class="note">
-<p><strong>注</strong>: GitHub上の例 (<a href="https://mdn.github.io/webassembly-examples/js-api-examples/">動作例</a>) の<a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/index.html">index.html</a>では、我々で定義した <code><a href="https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js#L1">fetchAndInstantiate()</a></code> ライブラリ関数を使用しています。</p>
-</div>
-
-<h2 id="仕様">仕様</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">仕様</th>
- <th scope="col">策定状況</th>
- <th scope="col">コメント</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName('WebAssembly JS', '#the-webassembly-object', 'WebAssembly')}}</td>
- <td>{{Spec2('WebAssembly JS')}}</td>
- <td>初回ドラフト定義。</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザ実装状況</h2>
-
-<div>{{Compat("javascript.builtins.WebAssembly")}}</div>
-
-<h2 id="関連情報">関連情報</h2>
-
-<ul>
- <li><a href="/ja/docs/WebAssembly">WebAssembly</a> overview page</li>
- <li><a href="/ja/docs/WebAssembly/Concepts">WebAssembly のコンセプト</a></li>
- <li><a href="/ja/docs/WebAssembly/Using_the_JavaScript_API">WebAssembly JavaScript API を使用する</a></li>
-</ul>