From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../global_objects/parallelarray/index.html | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html b/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html new file mode 100644 index 0000000000..739d25c173 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html @@ -0,0 +1,53 @@ +--- +title: ParallelArray +slug: Web/JavaScript/Reference/Global_Objects/ParallelArray +tags: + - JavaScript + - ParallelArray + - 过时 +translation_of: Archive/Web/ParallelArray +--- +

The goal of ParallelArray was to enable data-parallelism in web applications. The higher-order functions available on ParallelArray attempted to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of JS that Firefox supports.

+ +

语法

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

ParallelArray instances

+ +

属性

+ +
+
length
+
Reflects the number of elements in the ParallelArray.
+
+ +

方法

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

示例

+ +

Using map in parallel

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

参见

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