DedicatedWorkerGlobalScope
object (the
Worker
global scope) is accessible through the
self
keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the
JavaScript 参考
. See also:
Functions available to workers
.
此接口继承的特性来自
WorkerGlobalScope
interface, and its parent
EventTarget
, and therefore implements properties from
WindowTimers
,
WindowBase64
,和
WindowEventHandlers
.
DedicatedWorkerGlobalScope.name
只读
Worker
was (optionally) given when it was created using the
Worker()
constructor. This is mainly useful for debugging purposes.
WorkerGlobalScope.self
DedicatedWorkerGlobalScope
对象自身。
WorkerGlobalScope.console
只读
控制台
associated with the worker.
WorkerGlobalScope.location
只读
WorkerLocation
associated with the worker.
WorkerLocation
is a specific location object, mostly a subset of the
定位
for browsing scopes, but adapted to workers.
WorkerGlobalScope.navigator
只读
WorkerNavigator
associated with the worker.
WorkerNavigator
is a specific navigator object, mostly a subset of the
Navigator
for browsing scopes, but adapted to workers.
WorkerGlobalScope.performance
只读
性能
object associated with the worker, which is a regular performance object, but with a subset of its properties and methods available.
This interface inherits event handlers from the
WorkerGlobalScope
interface, and its parent
EventTarget
, and therefore implements event handlers from
WindowTimers
,
WindowBase64
,和
WindowEventHandlers
.
DedicatedWorkerGlobalScope.onmessage
EventHandler
表示要调用的代码当
message
event is raised. These events are of type
MessageEvent
and will be called when the worker receives a message from the document that started it (i.e. from the
Worker.postMessage
method.)
DedicatedWorkerGlobalScope.onmessageerror
EventHandler
表示要调用的代码当
messageerror
事件被引发。
此接口继承的方法来自
WorkerGlobalScope
interface, and its parent
EventTarget
, and therefore implements methods from
WindowTimers
,
WindowBase64
,和
WindowEventHandlers
.
DedicatedWorkerGlobalScope.close()
WorkerGlobalScope
's event loop, effectively closing this particular scope.
DedicatedWorkerGlobalScope.postMessage()
any
JavaScript object — to the parent document that first spawned the worker.
WorkerGlobalScope.dump()
把消息写入控制台。
WorkerGlobalScope.importScripts()
importScripts('foo.js', 'bar.js');
WindowBase64.atob()
Decodes a string of data which has been encoded using base-64 encoding.
WindowBase64.btoa()
Creates a base-64 encoded ASCII string from a string of binary data.
WindowTimers.clearInterval()
WindowTimers.setInterval()
.
WindowTimers.clearTimeout()
WindowTimers.setTimeout()
.
WindowTimers.setInterval()
Schedules the execution of a function every X milliseconds.
WindowTimers.setTimeout()
Sets a delay for executing a function.
message
onmessage
特性。
messageerror
onmessageerror
特性。
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'DedicatedWorkerGlobalScope' in that specification. |
实时标准 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DedicatedWorkerGlobalScope
|
Chrome 4 | Edge 12 | Firefox 3.5 | IE 10 | Opera 10.6 | Safari 4 | WebView Android Yes | Chrome Android 18 | Firefox Android 4 | Opera Android 11 | Safari iOS 5.1 | Samsung Internet Android 1.0 |
close
|
Chrome Yes | Edge ≤79 | Firefox 54 | IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android 54 | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
message
event
|
Chrome 4 | Edge 12 | Firefox 3.5 | IE 10 | Opera 10.6 | Safari 4 | WebView Android 37 | Chrome Android Yes | Firefox Android 4 | Opera Android 11.5 | Safari iOS 5.1 | Samsung Internet Android Yes |
messageerror
event
|
Chrome 60 | Edge ≤79 | Firefox 57 | IE ? | Opera 47 | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android 57 | Opera Android 47 | Safari iOS ? | Samsung Internet Android 8.0 |
名称
|
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 |
onmessage
|
Chrome 4 | Edge 12 | Firefox 3.5 | IE 10 | Opera 10.6 | Safari 4 | WebView Android 37 | Chrome Android Yes | Firefox Android 4 | Opera Android 11 | Safari iOS 5.1 | Samsung Internet Android Yes |
onmessageerror
|
Chrome 60 | Edge ≤79 | Firefox 57 | IE ? | Opera 47 | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android 57 | Opera Android 44 | Safari iOS ? | Samsung Internet Android 8.0 |
postMessage
|
Chrome 4 | Edge 12 | Firefox 3.5 | IE 10 | Opera 10.6 | Safari 4 | WebView Android Yes | Chrome Android Yes | Firefox Android 4 | Opera Android 11 | Safari iOS 5.1 | Samsung Internet Android Yes |
完整支持
不支持
兼容性未知