From a065e04d529da1d847b5062a12c46d916408bf32 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 21:46:22 -0500 Subject: update based on https://github.com/mdn/yari/issues/2028 --- files/ja/code_snippets/modules/index.html | 32 ------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 files/ja/code_snippets/modules/index.html (limited to 'files/ja/code_snippets/modules') 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 ---- -

単純なコードで JavaScript モジュール を Mozilla 固有でないコードにします (ブラウザにポーティングする場合など)。eval() は、ユーザの入力に依存しない EXPORTED_SYMBOLS 配列上でのみ使用されるため心配いりません。

-
function importModule (thatObj) {
-    thatObj = thatObj || window;
-
-    var EXPORTED_SYMBOLS = [
-    // シンボルをここに置く
-    ];
-
-    // ここにコードを書く...
-
-    // コードの終わりに: ('i' や 'thatObj' はエクスポートされません!)
-    for (var i=0; i < EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);}
-}
-
-

あるいは、モジュールを一度だけ使用する場合:

-
(function (thatObj) {
-    thatObj = thatObj || window;
-
-    var EXPORTED_SYMBOLS = [
-    // シンボルをここに置く
-    ];
-
-    // ここにコードを書く...
-
-    // コードの終わりに: ('i' や 'thatObj' はエクスポートされません!)
-    for (var i=0; i < EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);}
-})(); // オブジェクトの引数をここに置けます
-- cgit v1.2.3-54-g00ecf