From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/worker/terminate/index.html | 106 ++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 files/zh-cn/web/api/worker/terminate/index.html (limited to 'files/zh-cn/web/api/worker/terminate') diff --git a/files/zh-cn/web/api/worker/terminate/index.html b/files/zh-cn/web/api/worker/terminate/index.html new file mode 100644 index 0000000000..f49f8f2c91 --- /dev/null +++ b/files/zh-cn/web/api/worker/terminate/index.html @@ -0,0 +1,106 @@ +--- +title: Worker.terminate() +slug: Web/API/Worker/terminate +translation_of: Web/API/Worker/terminate +--- +

{{APIRef("Web Workers API")}}

+ +

{{domxref("Worker")}} 接口中的 terminate()  方法用于立即终止 {{domxref("Worker")}} 的行为. 本方法并不会等待 worker 去完成它剩余的操作;worker 将会被立刻停止

+ +

Syntax

+ +
myWorker.terminate();
+ +

参数

+ +

没有。

+ +

返回值

+ +

Void.

+ +

Example

+ +

以下代码示例表明,通过使用 {{domxref("Worker.Worker", "Worker()")}} 构造器创建出的{{domxref("Worker")}} 对象,在下一步操作之后会被立即终止。

+ +
var myWorker = new Worker('worker.js');
+
+myWorker.terminate();
+
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "#dom-worker-terminate", "Worker.terminate()")}}{{Spec2('HTML WHATWG')}} 
+ +

Browser compatibility

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support4{{CompatVersionUnknown}}3.510.010.64
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidEdgeFirefox Mobile (Gecko)Firefox OS (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support4.4{{CompatVersionUnknown}}3.51.0.110.011.55.1
+
+ +

See also

+ +

{{domxref("Worker")}} 接口。

-- cgit v1.2.3-54-g00ecf