| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/self | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since July 2015.
Note: This feature is only available in Web Workers.
The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, or ServiceWorkerGlobalScope.
A global scope object (differs depending on the type of worker you are dealing with, as indicated above).
If you called
console.log(self);
inside a worker, you will get a worker global scope of the same type as that worker object written to the console something like the following:
DedicatedWorkerGlobalScope {
undefined: undefined, Infinity: Infinity, Math: MathConstructor, NaN: NaN, Intl: Object}
Infinity: Infinity
Array: function Array() { [native code] }
arguments: null
caller: null
isArray: function isArray() { [native code] }
length: 1
name: "Array"
observe: function observe() { [native code] }
prototype: Array[0]
unobserve: function unobserve() { [native code] }
__proto__: function Empty() {}
<function scope>
ArrayBuffer: function ArrayBuffer() { [native code] }
Blob: function Blob() { [native code] }
Boolean: function Boolean() { [native code] }
DataView: function DataView() { [native code] }
Date: function Date() { [native code] }
DedicatedWorkerGlobalScope: function DedicatedWorkerGlobalScope() { [native code] }
Error: function Error() { [native code] }
// etc. etc.
This provides a full list of the objects available to that worker scope, so it is quite a useful test if you want to see whether something is available to your worker or not. We also maintain a list of Functions and classes available to Web Workers.
| Specification |
|---|
| HTML # dom-workerglobalscope-self-dev |
This page was last modified on Aug 4, 2026 by MDN contributors.
WorkerGlobalScopeYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |