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 --- .../global_objects/array/observe/index.html | 89 -------------- .../global_objects/array/unobserve/index.html | 134 --------------------- .../global_objects/arraybuffer/transfer/index.html | 126 ------------------- .../reference/global_objects/iterator/index.html | 95 --------------- .../global_objects/object/count/index.html | 44 ------- .../global_objects/parallelarray/index.html | 59 --------- .../global_objects/stopiteration/index.html | 66 ---------- .../global_objects/string/quote/index.html | 75 ------------ 8 files changed, 688 deletions(-) delete mode 100644 files/ja/web/javascript/reference/global_objects/array/observe/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/array/unobserve/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/arraybuffer/transfer/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/iterator/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/object/count/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/parallelarray/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/stopiteration/index.html delete mode 100644 files/ja/web/javascript/reference/global_objects/string/quote/index.html (limited to 'files/ja/web/javascript/reference/global_objects') diff --git a/files/ja/web/javascript/reference/global_objects/array/observe/index.html b/files/ja/web/javascript/reference/global_objects/array/observe/index.html deleted file mode 100644 index e480baf2e3..0000000000 --- a/files/ja/web/javascript/reference/global_objects/array/observe/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Array.observe() -slug: Web/JavaScript/Reference/Global_Objects/Array/observe -tags: - - Array - - JavaScript - - Method - - Obsolete -translation_of: Archive/Web/JavaScript/Array.observe ---- -
{{JSRef}} {{obsolete_header}}
- -

Array.observe() メソッドは、配列への変更を非同期で監視するために使用されました。オブジェクト用の {{jsxref("Object.observe()")}} と似ています。変更内容は、発生した順番に時系列で提供されます。accept type list ["add", "update", "delete", "splice"] で呼び出された Object.observe() と同等です。しかしながら、この API の使用は非推奨となり、ブラウザから削除されています。代わりに、一般的な {{jsxref("Proxy")}} オブジェクトを使用してください。

- -

構文

- -
Array.observe(arr, callback)
- -

引数

- -
-
arr
-
監視される配列。
-
callback
-
変更されるたびに毎回呼び出される関数。次の引数を持ちます: -
-
changes
-
変更されたオブジェクトの配列。変更オブジェクトのプロパティは次の通り: -
    -
  • name: 変更されたプロパティの名前。
  • -
  • object: 変更後の配列。
  • -
  • type: 変更の種類を示す文字列。 "add", "update", "delete", "splice" のいずれか一つ。
  • -
  • oldValue: "update", "delete" の場合のみ、変更前の値。
  • -
  • index: "splice" の場合のみ。変更が発生したインデックス。
  • -
  • removed: "splice" の場合のみ。取り除かれた要素の配列。
  • -
  • addedCount: "splice" の場合のみ。追加された要素の数。
  • -
-
-
-
-
- -

説明

- -

callback 関数は、arr に変更が発生する度に呼ばれます。すべての変更が発生した順に配列として渡されます。

- -
-

Array.prototype.pop() など、Array メソッド経由の変更は、"splice" 変更として報告されます。配列の長さが変更されないインデックスの割り当て変更は、"update" 変更として報告されます。

-
- -

- -

異なる変更のログを取る

- -
var arr = ['a', 'b', 'c'];
-
-Array.observe(arr, function(changes) {
-  console.log(changes);
-});
-
-arr[1] = 'B';
-// [{type: 'update', object: , name: '1', oldValue: 'b'}]
-
-arr[3] = 'd';
-// [{type: 'splice', object: , index: 3, removed: [], addedCount: 1}]
-
-arr.splice(1, 2, 'beta', 'gamma', 'delta');
-// [{type: 'splice', object: , index: 1, removed: ['B', 'c', 'd'], addedCount: 3}]
-
- -

仕様

- -

Strawman proposal specification.

- -

ブラウザ実装状況

- -
-

{{Compat("javascript.builtins.Array.observe")}}

-
- -

 

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/array/unobserve/index.html b/files/ja/web/javascript/reference/global_objects/array/unobserve/index.html deleted file mode 100644 index 1eafff5efa..0000000000 --- a/files/ja/web/javascript/reference/global_objects/array/unobserve/index.html +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: Array.unobserve -slug: Web/JavaScript/Reference/Global_Objects/Array/unobserve -tags: - - Array - - JavaScript - - Method - - Obsolete -translation_of: Archive/Web/JavaScript/Array.unobserve ---- -
{{JSRef}} {{obsolete_header}}
- -

Array.unobserve()メソッドは、{{jsxref("Array.observe()")}} で設定された監視を削除するために使われていましたが、非推奨となりブラウザから削除されました。代わりに、一般的な {{jsxref("Proxy")}} オブジェクトを使用してください。

- -

構文

- -
Array.unobserve(arr, callback)
- -

引数

- -
-
arr
-
監視を停止する配列。
-
callback
-
arr 配列の変更時に毎回呼び出されるのを停止するための、オブザーバへの参照。
-
- -

説明

- -

配列からオブザーバを削除するため、Array.unobserve() は {{jsxref("Array.observe()")}} の後に呼び出される必要があります。

- -

callback は関数への参照とすべきであり、匿名関数ではいけません。なぜなら、この参照は以前のオブザーバを解除するために使用されるからです。callback として匿名関数を使った Array.unobserve() の呼び出しは、オブザーバを削除できないので無意味です。

- -

- -

配列の監視を削除

- -
var arr = [1, 2, 3];
-
-var observer = function(changes) {
-  console.log(changes);
-}
-
-Array.observe(arr, observer);
-​
-arr.push(4);
-// [{type: "splice", object: <arr>, index: 3, removed:[], addedCount: 1}]
-
-Array.unobserve(arr, observer);
-
-arr.pop();
-// callback は呼び出されなかった。
- -

匿名関数の使用

- -
var persons = ['Khalid', 'Ahmed', 'Mohammed'];
-
-Array.observe(persons, function (changes) {
-  console.log(changes);
-});
-
-persons.shift();
-// [{type: "splice", object: <arr>, index: 0, removed: [ "Khalid" ], addedCount: 0 }]
-
-Array.unobserve(persons, function (changes) {
-  console.log(changes);
-});
-
-persons.push('Abdullah');
-// [{type: "splice", object: <arr>, index: 2, removed: [], addedCount: 1 }]
-// callback は常に呼び出される。
-
- -

ブラウザ実装状況

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本サポート{{CompatChrome("36")}} [1]{{CompatNo}}{{CompatNo}}{{CompatOpera("23")}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
機能AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本サポート{{CompatNo}}{{CompatChrome("36")}} [1]{{CompatNo}}{{CompatNo}}{{CompatOpera("23")}}{{CompatNo}}
-
- -

[1] Chrome 49 で非推奨になりました。

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/arraybuffer/transfer/index.html b/files/ja/web/javascript/reference/global_objects/arraybuffer/transfer/index.html deleted file mode 100644 index 2070e902a4..0000000000 --- a/files/ja/web/javascript/reference/global_objects/arraybuffer/transfer/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: ArrayBuffer.transfer() -slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transfer -tags: - - ArrayBuffer - - ECMAScript7 - - Experimental - - Expérimental(2) - - JavaScript - - Method - - Reference - - Référence(2) - - TypedArrays -translation_of: Archive/Web/JavaScript/ArrayBuffer.transfer ---- -
{{JSRef}} {{SeeCompatTable}}
- -

静的な ArrayBuffer.transfer() メソッドは、oldBuffer のデータから得られる内容の新しい ArrayBuffer を返し、newByteLength によって切断されるかゼロ拡張されます。newByteLengthundefined なら、oldBufferbyteLength が使われます。この操作により oldBuffer はデタッチ状態のままになります。

- -

構文

- -
ArrayBuffer.transfer(oldBuffer [, newByteLength]);
- -

引数

- -
-
oldBuffer
-
転送するための {{jsxref("ArrayBuffer")}} オブジェクト
-
newByteLength
-
新しい ArrayBuffer オブジェクトのバイト長
-
- -

戻り値

- -

新しい ArrayBuffer オブジェクト。

- -

説明

- -

ArrayBuffer.transfer() メソッドによって、ArrayBuffer オブジェクトを成長し、デタッチできます。コピーなしで ArrayBuffer を成長される能力は大規模バッファに対してもっと早くなる利点を持っています。ArrayBuffer をデタッチする機能によって、基底メモリがリリースされるときを開発者が明示的に制御できます。これにより、すべての参照を削除し、ガベージコレクションを待たずに済みます。

- -

- -
var buf1 = new ArrayBuffer(40);
-new Int32Array(buf1)[0] = 42;
-
-var buf2 = ArrayBuffer.transfer(buf1, 80);
-buf1.byteLength; // 0
-buf2.byteLength; // 80
-new Int32Array(buf2)[0]; // 42
-
-var buf3 = ArrayBuffer.transfer(buf2, 0);
-buf2.byteLength; // 0
-buf3.byteLength; // 0
-
- -

ポリフィル

- -

次のコードをスクリプトの先頭に挿入することで、transfer() の機能の大部分をネイティブにサポートしていない環境でも対処できるようになります。これはこの API と完全に同じではありませんが、この関数はある ArrayBuffer からそのほかの ArrayBuffer にデータを変換します。

- -
if (!ArrayBuffer.transfer) {
-    ArrayBuffer.transfer = function(source, length) {
-        source = Object(source);
-        var dest = new ArrayBuffer(length);
-        if (!(source instanceof ArrayBuffer) || !(dest instanceof ArrayBuffer)) {
-            throw new TypeError('Source and destination must be ArrayBuffer instances');
-        }
-        if (dest.byteLength >= source.byteLength) {
-            var nextOffset = 0;
-            var leftBytes = source.byteLength;
-            var wordSizes = [8, 4, 2, 1];
-            wordSizes.forEach(function(_wordSize_) {
-                if (leftBytes >= _wordSize_) {
-                    var done = transferWith(_wordSize_, source, dest, nextOffset, leftBytes);
-                    nextOffset = done.nextOffset;
-                    leftBytes = done.leftBytes;
-                }
-            });
-        }
-        return dest;
-        function transferWith(wordSize, source, dest, nextOffset, leftBytes) {
-            var ViewClass = Uint8Array;
-            switch (wordSize) {
-                case 8:
-                    ViewClass = Float64Array;
-                    break;
-                case 4:
-                    ViewClass = Float32Array;
-                    break;
-                case 2:
-                    ViewClass = Uint16Array;
-                    break;
-                case 1:
-                    ViewClass = Uint8Array;
-                    break;
-                default:
-                    ViewClass = Uint8Array;
-                    break;
-            }
-            var view_source = new ViewClass(source, nextOffset, Math.trunc(leftBytes / wordSize));
-            var view_dest = new ViewClass(dest, nextOffset, Math.trunc(leftBytes / wordSize));
-            for (var i = 0; i < view_dest.length; i++) {
-                view_dest[i] = view_source[i];
-            }
-            return {
-                nextOffset : view_source.byteOffset + view_source.byteLength,
-                leftBytes : source.byteLength - (view_source.byteOffset + view_source.byteLength)
-            }
-        }
-    };
-}
- -

仕様

- -

いづれの現行仕様のドラフトにも含まれていませんが、ECMA-262 エディションの機能として提案されました

- -

ブラウザ実装状況

- - - -

{{Compat("javascript.builtins.ArrayBuffer.transfer")}}

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/iterator/index.html b/files/ja/web/javascript/reference/global_objects/iterator/index.html deleted file mode 100644 index 3a641ff7d9..0000000000 --- a/files/ja/web/javascript/reference/global_objects/iterator/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Iterator -slug: Web/JavaScript/Reference/Global_Objects/Iterator -tags: - - Deprecated - - JavaScript - - Legacy Iterator - - Reference -translation_of: Archive/Web/Iterator ---- -
{{jsSidebar("Objects")}}
- -
非標準。 Iterator 関数は SpiderMonkey固有の機能で、ある時点で削除されます。将来向きの用途に対して、for..ofループとiterator protocolを使用することを検討してください。
- -

概要

- -

レガシーイテレータプロトコルを実装し、オブジェクトの列挙可能なプロパティに対して反復するオブジェクトを返します。

- -

構文

- -
Iterator(object, [keyOnly])
- -

引数

- -
-
object
-
プロパティを反復処理するオブジェクト。
-
keyOnly
-
keyOnly が truthy な値である場合は、Iterator.prototype.nextproperty_name のみ返します。
-
- -

説明

- -

使用方法の概要がIterators and Generatorsページで提供されています。

- -

メソッド

- -
-
Iterator.prototype.next
-
[property_name, property_value]フォーマットで次のアイテムを返します。それ以上のアイテムが存在しない場合、StopIterationをスローします。
-
- -

- -

オブジェクトのプロパティを反復処理する

- -
var a = {
-  x: 10,
-  y: 20,
-};
-var iter = Iterator(a);
-console.log(iter.next()); // ["x", 10]
-console.log(iter.next()); // ["y", 20]
-console.log(iter.next()); // throws StopIteration
-
- -

レガシーデストラクタfor-in文を使用してオブジェクトのプロパティを反復処理する

- -
var a = {
-  x: 10,
-  y: 20,
-};
-
-for (var [name, value] in Iterator(a)) {
-  console.log(name, value);   // x 10
-                              // y 20
-}
-
- -

for-ofとともにイテレータを使用する

- -
var a = {
-  x: 10,
-  y: 20,
-};
-
-for (var [name, value] of Iterator(a)) {  // @@iterator is used
-  console.log(name, value);   // x 10
-                              // y 20
-}
- -

仕様

- -

非標準。すべての現在の仕様書でサポートされていません。

- -

ブラウザ実装状況

- -

サポートされていません。バージョン 57 より前の Firefox でサポートしていました。

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/object/count/index.html b/files/ja/web/javascript/reference/global_objects/object/count/index.html deleted file mode 100644 index 62975242b6..0000000000 --- a/files/ja/web/javascript/reference/global_objects/object/count/index.html +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Object.prototype.__count__ -slug: Web/JavaScript/Reference/Global_Objects/Object/count -tags: - - JavaScript - - Object - - Obsolute - - Property - - Prototype -translation_of: Archive/Web/JavaScript/Object.count ---- -
{{JSRef}}{{Non-standard_Header}}{{obsolete_header("gecko2")}}
- -

__count__ プロパティはオブジェクトの列挙可能なプロパティの数を保存するために使用されていましたが、削除されました。

- -

構文

- -
obj.__count__
- -

- -
{ 1: 1 }.__count__              // 1
-[].__count__                    // 0
-[1].__count__                   // 1
-[1, /* hole */, 2, 3].__count__ // 3
-
- -

仕様書

- -

どの仕様書でも定義されていません。

- -

ブラウザーの対応

- -
- - -

{{Compat("javascript.builtins.Object.count")}}

-
- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/parallelarray/index.html b/files/ja/web/javascript/reference/global_objects/parallelarray/index.html deleted file mode 100644 index 192b09e3f4..0000000000 --- a/files/ja/web/javascript/reference/global_objects/parallelarray/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: ParallelArray -slug: Web/JavaScript/Reference/Global_Objects/ParallelArray -tags: - - JavaScript - - Obsolete - - ParallelArray -translation_of: Archive/Web/ParallelArray ---- -
-
{{jsSidebar("Objects")}}{{obsolete_header}}
-
- -
p>ノート: このオブジェクトは Firefox 17 で実装され {{ Gecko(29) }} から削除されました。現在は Nightly チャネルでのみ ParallelJS (PJS) を使用可能です ({{ bug(944074) }})。
- -

ParallelArray の目標は、ウェブアプリケーション上でデータ並列性を実現することです。ParallelArray 上で利用可能な高階関数は並列的に実行されます(ただし、並列的に実行できない場合は必要に応じて直列実行にフォールバックします)。並列実行性を保証したい場合には、Javascript の機能のうち、Firefox がサポートする並列可能なサブセットのみを利用するようにすることが推奨されています。

- -

構文

- -
new ParallelArray()
-new ParallelArray([element0, element1, ...])
-new ParallelArray(arrayLength, elementalFunction)
- -

ParallelArray インスタンス

- -

プロパティ

- -
-
length
-
ParallelArrayの要素の数
-
- -

メソッド

- -
-
map
-
reduce
-
scan
-
scatter
-
filter
-
flatten
-
partition
-
get
-
- -

- -

例: 並列的に map 処理を行う

- -
var p = new ParallelArray([0, 1, 2, 3, 4]);
-var m = p.map(function (v) {
-  return v + 1;
-});
- -

参考文献

- - diff --git a/files/ja/web/javascript/reference/global_objects/stopiteration/index.html b/files/ja/web/javascript/reference/global_objects/stopiteration/index.html deleted file mode 100644 index 79972224a8..0000000000 --- a/files/ja/web/javascript/reference/global_objects/stopiteration/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: StopIteration -slug: Web/JavaScript/Reference/Global_Objects/StopIteration -tags: - - JavaScript - - Legacy Iterator - - Non-standard - - Reference - - StopItaration -translation_of: Archive/Web/StopIteration ---- -
{{jsSidebar("Objects")}}
- -
非標準。 StopIteration オブジェクトはSpiderMonkey特有の機能です。将来向きの用途に対して、for..of ループとiterator protocolを使用することを検討してください。
- -

概要

- -

StopIteration オブジェクトはレガシーイテレータプロトコルにおける反復の終了を通知するために使用します。

- -

構文

- -
StopIteration
- -

説明

- -

使用法の概要は、Iterators and Generators ページ上で利用可能です

- -

- -

StopIterationIteratorによってスローされます。

- -
var a = {
-  x: 10,
-  y: 20,
-};
-var iter = Iterator(a);
-console.log(iter.next()); // ["x", 10]
-console.log(iter.next()); // ["y", 20]
-console.log(iter.next()); // throws StopIteration
-
- -

StopIterationをスローする。

- -
function f() {
-  yield 1;
-  yield 2;
-  throw StopIteration;
-  yield 3; // this is not executed.
-}
-
-for (var n in f()) {
-  console.log(n);   // 1
-                    // 2
-}
-
- -

仕様

- -

非標準。すべての現在の標準仕様でサポートされていません。

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/string/quote/index.html b/files/ja/web/javascript/reference/global_objects/string/quote/index.html deleted file mode 100644 index 2a074faf32..0000000000 --- a/files/ja/web/javascript/reference/global_objects/string/quote/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: String.prototype.quote() -slug: Web/JavaScript/Reference/Global_Objects/String/quote -tags: - - String - - String Methods -translation_of: Archive/Web/JavaScript/String.quote ---- -
{{JSRef}} {{obsolete_header("37")}} {{non-standard_header}}
- -

特殊文字をエスケープシーケンスで置換しダブル・クォーテーション(")でラップした文字列のコピーを返します。

- -

構文

- -
str.quote()
- -

Return value

- -

A new string representing the original string wrapped in double-quotes, with any special characters escaped.

- -

- -

In the table below thequote()method replaces any special characters and wraps the strings in double-quotes. Also note the third column where a wrapped {{jsxref("Global_Objects/eval", "eval()")}} evaluates the escape sequences again.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
strstr.quote()eval( str.quote() )
Hello world!"Hello world!"Hello world!
Hello
-         world!
"Hello\n\tworld!"Hello
-         world!
" \ — '"\" \\ \u2014 '"" \ — '
- -

仕様

- -

Not part of any standard. Implemented in JavaScript 1.3.

- -

ポリフィル

- -
if (!String.prototype.quote)
-    String.prototype.quote = function(){
-        return JSON.stringify( this ); // since IE8
-    }
- -

ブラウザ互換性情報

- - - -

{{Compat("javascript.builtins.String.quote")}}

- -

関連情報

- - -- cgit v1.2.3-54-g00ecf