aboutsummaryrefslogtreecommitdiff
path: root/files/ja/code_snippets/modules
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/code_snippets/modules')
-rw-r--r--files/ja/code_snippets/modules/index.html32
1 files changed, 0 insertions, 32 deletions
diff --git a/files/ja/code_snippets/modules/index.html b/files/ja/code_snippets/modules/index.html
deleted file mode 100644
index 46b808913a..0000000000
--- a/files/ja/code_snippets/modules/index.html
+++ /dev/null
@@ -1,32 +0,0 @@
----
-title: モジュール
-slug: Code_snippets/Modules
-translation_of: Archive/Add-ons/Code_snippets/Modules
----
-<p>単純なコードで <a href="/ja/JavaScript_code_modules" title="ja/JavaScript code modules">JavaScript モジュール</a> を Mozilla 固有でないコードにします (ブラウザにポーティングする場合など)。eval() は、ユーザの入力に依存しない <code>EXPORTED_SYMBOLS</code> 配列上でのみ使用されるため心配いりません。</p>
-<pre class="brush: js">function importModule (thatObj) {
- thatObj = thatObj || window;
-
- var EXPORTED_SYMBOLS = [
- // シンボルをここに置く
- ];
-
- // ここにコードを書く...
-
- // コードの終わりに: ('i' や 'thatObj' はエクスポートされません!)
- for (var i=0; i &lt; EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);}
-}
-</pre>
-<p>あるいは、モジュールを一度だけ使用する場合:</p>
-<pre class="brush: js">(function (thatObj) {
- thatObj = thatObj || window;
-
- var EXPORTED_SYMBOLS = [
- // シンボルをここに置く
- ];
-
- // ここにコードを書く...
-
- // コードの終わりに: ('i' や 'thatObj' はエクスポートされません!)
- for (var i=0; i &lt; EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);}
-})(); // オブジェクトの引数をここに置けます</pre>