SharedWorkerGlobalScope
SharedWorkerGlobalScope
オブジェクト ( SharedWorker
グローバルスコープ) は、 self
キーワードでアクセスできます。一部の追加のグローバル関数、名前空間オブジェクト、コンストラクターは、通常はワーカーのグローバルスコープに関連付けられていませんが、利用することができ、 JavaScript リファレンスに列挙されています。ワーカーで利用できる機能の完全なリストを参照してください。
プロパティ
このインターフェイスは WorkerGlobalScope
、またその親の EventTarget
インターフェイスからプロパティを継承しており、したがって WindowTimers
, WindowBase64
, WindowEventHandlers
のプロパティを実装しています。
- The name that the
SharedWorker
was (optionally) given when it was created using theSharedWorker()
(en-US) constructor. This is mainly useful for debugging purposes. - This property returns the
ApplicationCache
object for the worker (see Using the application cache).
WorkerGlobalScope から継承しているプロパティ
WorkerGlobalScope.self
- Returns an object reference to the
DedicatedWorkerGlobalScope
object itself. WorkerGlobalScope.console
読取専用- Returns the
Console
associated with the worker. WorkerGlobalScope.location
(en-US) 読取専用- Returns the
WorkerLocation
associated with the worker.WorkerLocation
is a specific location object, mostly a subset of theLocation
for browsing scopes, but adapted to workers. - Returns the
WorkerNavigator
(en-US) associated with the worker.WorkerNavigator
is a specific navigator object, mostly a subset of theNavigator
for browsing scopes, but adapted to workers. WorkerGlobalScope.performance
(en-US) 読取専用 Non-Standard- Returns the
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
, and WindowEventHandlers
.
- Is an
event handler
representing the code to be called when theconnect
event is raised — that is, when aMessagePort
connection is opened between the associatedSharedWorker
and the main thread.
メソッド
This interface inherits methods from the WorkerGlobalScope
interface, and its parent EventTarget
, and therefore implements methods from WindowTimers
, WindowBase64
, and WindowEventHandlers
.
- Discards any tasks queued in the
SharedWorkerGlobalScope
's event loop, effectively closing this particular scope.
WorkerGlobalScope から継承したもの
WorkerGlobalScope.close()
(en-US) Deprecated- Discards any tasks queued in the
WorkerGlobalScope
's event loop, effectively closing this particular scope. WorkerGlobalScope.dump()
(en-US) Non-Standard- Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's
window.dump
, but for workers. WorkerGlobalScope.importScripts()
- Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:
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()
- Cancels the repeated execution set using
WindowTimers.setInterval()
. WindowTimers.clearTimeout()
- Cancels the repeated execution set using
WindowTimers.setTimeout()
. WindowTimers.setInterval()
- Schedules the execution of a function every X milliseconds.
WindowTimers.setTimeout()
- Sets a delay for executing a function.
イベント
Listen to this event using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
connect
- Fired on shared workers when a new client connects.
Also available via theonconnect (en-US)
property.
仕様書
仕様書 | 状態 | 備考 |
---|---|---|
HTML Living Standard SharedWorkerGlobalScope の定義 |
現行の標準 |
ブラウザーの互換性
BCD tables only load in the browser