名称 只读特性在 DedicatedWorkerGlobalScope interface returns the name that the Worker was (optionally) given when it was created. This is the name that the Worker() constructor can pass to get a reference to the DedicatedWorkerGlobalScope .

句法

var nameObj = self.name;
					

A DOMString .

范例

If a worker is created using a constructor with a 名称 选项:

var myWorker = new Worker("worker.js", { name : "myWorker" });
					

the DedicatedWorkerGlobalScope will now have a name of "myWorker", returnable by running

self.name
					

from inside the worker.

规范

规范 状态 注释
HTML 实时标准
The definition of 'name' in that specification.
实时标准

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
名称 Chrome Yes Edge ≤79 Firefox 55 IE 不支持 No Opera ? Safari 不支持 No WebView Android Yes Chrome Android Yes Firefox Android 55 Opera Android ? Safari iOS 不支持 No Samsung Internet Android Yes

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: