From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/workerglobalscope/console/index.html | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 files/ja/web/api/workerglobalscope/console/index.html (limited to 'files/ja/web/api/workerglobalscope/console') diff --git a/files/ja/web/api/workerglobalscope/console/index.html b/files/ja/web/api/workerglobalscope/console/index.html new file mode 100644 index 0000000000..17626a7181 --- /dev/null +++ b/files/ja/web/api/workerglobalscope/console/index.html @@ -0,0 +1,50 @@ +--- +title: WorkerGlobalScope.console +slug: Web/API/WorkerGlobalScope/console +tags: + - API + - ウェブワーカー + - リファレンス + - リファレンス(2) + - ワーカーグローバルスコープ + - 読み込み専用 +translation_of: Web/API/WorkerGlobalScope/console +--- +

{{APIRef("Web Workers API")}}{{Non-standard_header}}

+ +

{{domxref("Console")}} インターフェイスの読み取り専用 console プロパティは、ワーカーにブラウザコンソールへのアクセスを提供する {{domxref("Console")}} オブジェクトを返します。

+ +

構文

+ +
var consoleObj = self.console;
+ +

+ +

{{domxref("Console")}} オブジェクト

+ +

+ +

このプロパティはワーカー内でデバッグのためにブラウザコンソールへアクセスすることを可能にします。よって、例えばこのようにコールできます

+ +
console.log('test');
+ +

inside a worker (which would basically be the equivalent of self.console.log('test');, as these are being called on the worker scope, which can be referenced with {{domxref("WorkerGlobalScope.self")}}), to return a test message out to the browser console.

+ +

If you are calling console.log() from a {{domxref("DedicatedWorkerGlobalScope")}} or other worker scope that acts on a single loaded window, that tab's web console will receive the logs. However, If you are calling console.log() from a {{domxref("SharedWorkerGlobalScope")}}, the global browser console will receive the logs.

+ +

仕様

+ +

仕様の一部ではありません。

+ +

Browser compatibility

+ + + +

{{Compat("api.WorkerGlobalScope.console")}}

+ +

関連

+ + -- cgit v1.2.3-54-g00ecf