aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/webassembly/global/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/webassembly/global/index.html')
-rw-r--r--files/ja/web/javascript/reference/global_objects/webassembly/global/index.html118
1 files changed, 0 insertions, 118 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/webassembly/global/index.html b/files/ja/web/javascript/reference/global_objects/webassembly/global/index.html
deleted file mode 100644
index 16817b0777..0000000000
--- a/files/ja/web/javascript/reference/global_objects/webassembly/global/index.html
+++ /dev/null
@@ -1,118 +0,0 @@
----
-title: WebAssembly.Global
-slug: Web/JavaScript/Reference/Global_Objects/WebAssembly/Global
-tags:
- - API
- - Constructor
- - JavaScript
- - Reference
- - WebAssembly
- - global
-translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Global
----
-<div>{{JSRef}}</div>
-
-<p><strong><code>WebAssembly.Global</code></strong> はグローバル変数として存在し、JavaScript または {{jsxref("WebAssembly.Module")}} インスタンスから参照することができます。これにより動的に複数のモジュールをリンクすることができます。</p>
-
-<h2 id="Constructor_Syntax" name="Constructor_Syntax">コンストラクターの文法</h2>
-
-<pre class="syntaxbox">var myGlobal = new WebAssembly.Global(<em>descriptor</em>, <em>value</em>);</pre>
-
-<h3 id="Parameters" name="Parameters">パラメーター</h3>
-
-<dl>
- <dt><em>descriptor</em></dt>
- <dd><code>GlobalDescriptor</code> 辞書オブジェクト、2 つの要素を持っている:
- <ul>
- <li><code>value</code>: {{domxref("USVString")}} はグローバルデータ形式を表し値として <code>i32</code>、<code>i64</code>、<code>f32</code>、<code>f64</code> のうち一つを取ります。</li>
- <li><code>mutable</code>: グローバルがミュータブルかどうかの真偽値です。デフォルトでは <code>false</code> です。</li>
- </ul>
- </dd>
- <dt><em>value</em></dt>
- <dd>変数が保持する値です。変数のデータ型に合う限りどんな値でも取れます。もしも何の値も渡されないと、<a href="https://webassembly.github.io/spec/js-api/#defaultvalue"><code>DefaultValue</code> algorithm</a> で指定した時の様な 型ありの 0 が使われます。</dd>
-</dl>
-
-<h2 id="Function_properties_of_the_Global_constructor" name="Function_properties_of_the_Global_constructor">グローバルコンストラクターによる関数プロパティ</h2>
-
-<p>無し</p>
-
-<h2 id="Global_instances" name="Global_instances">グローバルインスタンス</h2>
-
-<p>すべてのグローバルインスタンスは <code>Global()</code> コンストラクターのプロパティオブジェクトを受け継ぐ — これによりすべての <code>Global</code> インスタンスを変更できる</p>
-
-<h3 id="Instance_properties" name="Instance_properties">インスタンスプロパティ</h3>
-
-<p>{{page('/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global/prototype', 'Properties')}}</p>
-
-<h3 id="Instance_methods" name="Instance_methods">インスタンスメソッド</h3>
-
-<p>{{page('/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global/prototype', 'Methods')}}</p>
-
-<h2 id="Examples" name="Examples">例</h2>
-
-<p>以下の例では新しいグローバルインスタンスは <code>WebAssembly.Global()</code> コンストラクターを用いて初期化され、初期値 0 のミュータブルな <code>i32</code> 型として定義されます。</p>
-
-<p>その後この値は、<code>Global.value</code> プロパティを使うことによって <code>42</code> に、<code>global.wasm</code> モジュールから公開された <code>incGlobal()</code> 関数 (入力に限らず 1 を加算する) を使うことによって <code>43</code> になります。</p>
-
-<pre class="brush: js">const output = document.getElementById('output');
-
-function assertEq(msg, got, expected) {
- output.innerHTML += `Testing ${msg}: `;
- if (got !== expected)
- output.innerHTML += `FAIL!&lt;br&gt;Got: ${got}&lt;br&gt;Expected: ${expected}&lt;br&gt;`;
- else
- output.innerHTML += `SUCCESS! Got: ${got}&lt;br&gt;`;
-}
-
-assertEq("WebAssembly.Global exists", typeof WebAssembly.Global, "function");
-
-const global = new WebAssembly.Global({value:'i32', mutable:true}, 0);
-
-WebAssembly.instantiateStreaming(fetch('global.wasm'), { js: { global } })
-.then(({instance}) =&gt; {
- assertEq("getting initial value from wasm", instance.exports.getGlobal(), 0);
- global.value = 42;
- assertEq("getting JS-updated value from wasm", instance.exports.getGlobal(), 42);
- instance.exports.incGlobal();
- assertEq("getting wasm-updated value from JS", global.value, 43);
-});</pre>
-
-<div class="note">
-<p><strong>メモ</strong>: <a href="https://mdn.github.io/webassembly-examples/js-api-examples/global.html">GitHub 上で動くデモ</a>が試せます。<a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/global.html">ソースコード</a>も確認してみてください。</p>
-</div>
-
-<h2 id="Specifications" name="Specifications">仕様</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', '#globals', 'WebAssembly.Global()')}}</td>
- <td>{{Spec2('WebAssembly JS')}}</td>
- <td>初回ドラフト定義</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2>
-
-<div>
-
-
-<p>{{Compat("javascript.builtins.WebAssembly.Global")}}</p>
-</div>
-
-<h2 id="See_also" name="See_also">参考</h2>
-
-<ul>
- <li><a href="/ja/docs/WebAssembly">WebAssembly</a> 概要ページ</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>
- <li><a href="https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md">Import/Export mutable globals proposal</a></li>
-</ul>