aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/windowclient
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/windowclient
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/windowclient')
-rw-r--r--files/ja/web/api/windowclient/focus/index.html75
-rw-r--r--files/ja/web/api/windowclient/focused/index.html73
-rw-r--r--files/ja/web/api/windowclient/index.html97
-rw-r--r--files/ja/web/api/windowclient/navigate/index.html57
-rw-r--r--files/ja/web/api/windowclient/visibilitystate/index.html69
5 files changed, 371 insertions, 0 deletions
diff --git a/files/ja/web/api/windowclient/focus/index.html b/files/ja/web/api/windowclient/focus/index.html
new file mode 100644
index 0000000000..598e69ad62
--- /dev/null
+++ b/files/ja/web/api/windowclient/focus/index.html
@@ -0,0 +1,75 @@
+---
+title: WindowClient.focus()
+slug: Web/API/WindowClient/focus
+tags:
+ - API
+ - Focus
+ - Method
+ - Reference
+ - Service Workers
+ - WindowClient
+translation_of: Web/API/WindowClient/focus
+---
+<p>{{APIRef("Service Workers API")}}</p>
+
+<p><span class="seoSummary">{{domxref("WindowClient")}} インターフェイスの <strong><code>focus()</code></strong> メソッドは、現在のクライアントにユーザー入力フォーカスを与え、既存の {{domxref("WindowClient")}} に解決する {{jsxref("Promise")}} を返します。</span></p>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox"><em>windowClient</em>.focus().then(function(<em>windowClient</em>) {
+ // WindowClient がフォーカスされたら、何かを行います
+});</pre>
+
+<h3 id="Parameters" name="Parameters">パラメーター</h3>
+
+<p>なし。</p>
+
+<h3 id="Return_value" name="Return_value">戻り値</h3>
+
+<p>既存の {{domxref("WindowClient")}} に解決される {{jsxref("Promise")}}。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre class="brush: js">self.addEventListener('notificationclick', function(event) {
+ console.log('On notification click: ', event.notification.tag);
+ event.notification.close();
+
+ // これは、クライアントが既に開いているかどうかを確認し、
+ // 開いている場合にフォーカスを合わせます
+ event.waitUntil(clients.matchAll({
+ type: "window"
+ }).then(function(clientList) {
+ for (var i = 0; i &lt; clientList.length; i++) {
+ var client = clientList[i];
+ if (client.url == '/' &amp;&amp; 'focus' in client)
+ return client.focus();
+ }
+ if (clients.openWindow)
+ return clients.openWindow('/');
+ }));
+});</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Service Workers', '#dom-windowclient-focus', 'focus()')}}</td>
+ <td>{{Spec2('Service Workers')}}</td>
+ <td>初期定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.WindowClient.focus")}}</p>
+</div>
diff --git a/files/ja/web/api/windowclient/focused/index.html b/files/ja/web/api/windowclient/focused/index.html
new file mode 100644
index 0000000000..31eefaf0dd
--- /dev/null
+++ b/files/ja/web/api/windowclient/focused/index.html
@@ -0,0 +1,73 @@
+---
+title: WindowClient.focused
+slug: Web/API/WindowClient/focused
+tags:
+ - API
+ - Property
+ - Reference
+ - Service Workers
+ - ServiceWorker
+ - WindowClient
+ - focused
+translation_of: Web/API/WindowClient/focused
+---
+<div>{{APIRef("Service Workers API")}}</div>
+
+<p><span class="seoSummary">{{domxref("WindowClient")}} インターフェイスの <strong><code>focused</code></strong> 読み取り専用プロパティは、現在のクライアントにフォーカスがあるかどうかを示す {{jsxref("Boolean")}} です。</span></p>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox">var <em>myFocused</em> = <em>windowClient</em>.focused;</pre>
+
+<h3 id="Value" name="Value">値</h3>
+
+<p>{{jsxref("Boolean")}}。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre class="brush: js">self.addEventListener('notificationclick', function(event) {
+ console.log('On notification click: ', event.notification.tag);
+ event.notification.close();
+
+ // これは、クライアントが既に開いているかどうかを確認し、
+ // 開いている場合にフォーカスを合わせます
+ event.waitUntil(clients.matchAll({
+ type: "window"
+ }).then(function(clientList) {
+ for (var i = 0; i &lt; clientList.length; i++) {
+ var client = clientList[i];
+ if (client.url == '/' &amp;&amp; 'focus' in client) {
+ if(!client.focused)
+ return client.focus();
+ }
+ }
+ }
+ if (clients.openWindow)
+ return clients.openWindow('/');
+ }));
+});</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Service Workers', '#dom-windowclient-focused', 'WindowClient: focused')}}</td>
+ <td>{{Spec2('Service Workers')}}</td>
+ <td>初期定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.WindowClient.focused")}}</p>
+</div>
diff --git a/files/ja/web/api/windowclient/index.html b/files/ja/web/api/windowclient/index.html
new file mode 100644
index 0000000000..5189c134b7
--- /dev/null
+++ b/files/ja/web/api/windowclient/index.html
@@ -0,0 +1,97 @@
+---
+title: WindowClient
+slug: Web/API/WindowClient
+tags:
+ - API
+ - Client
+ - Interface
+ - Reference
+ - Service Workers
+ - ServiceWorker
+ - WindowClient
+translation_of: Web/API/WindowClient
+---
+<p>{{APIRef("Service Workers API")}}</p>
+
+<p><a href="/ja/docs/Web/API/Service_Worker_API">Service Worker API</a> の <strong><code>WindowClient</code></strong> インターフェイスは、アクティブなワーカーによって制御される閲覧コンテキスト内のドキュメントであるサービスワーカークライアントのスコープを表します。 サービスワーカークライアントは、それ自身の読み込みとサブリソースに対してサービスワーカーを個別に選択して使用します。</p>
+
+<h2 id="Methods" name="Methods">メソッド</h2>
+
+<p><em><code>WindowClient</code> は、親インターフェースである {{domxref("Client")}} からメソッドを継承します。</em></p>
+
+<dl>
+ <dt>{{domxref("WindowClient.focus()")}}</dt>
+ <dd>現在のクライアントにユーザー入力フォーカスを与えます。</dd>
+ <dt>{{domxref("WindowClient.navigate()")}}</dt>
+ <dd>指定された URL を制御されたクライアントのページに読み込みます。</dd>
+</dl>
+
+<h2 id="Properties" name="Properties">プロパティ</h2>
+
+<p><em><code>WindowClient</code> は、親インターフェースである {{domxref("Client")}} からプロパティを継承します。</em></p>
+
+<dl>
+ <dt>{{domxref("WindowClient.focused")}} {{readonlyInline}}</dt>
+ <dd>現在のクライアントにフォーカスがあるかどうかを示すブール値。</dd>
+ <dt>{{domxref("WindowClient.visibilityState")}} {{readonlyInline}}</dt>
+ <dd>現在のクライアントの可視性を示します。 この値は、<code>"hidden"</code>、<code>"visible"</code>、<code>"prerender"</code> のいずれかです。</dd>
+</dl>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre class="brush: js">self.addEventListener('notificationclick', function(event) {
+ console.log('On notification click: ', event.notification.tag);
+ event.notification.close();
+
+ // これは、クライアントが既に開いているかどうかを確認し、
+ // 開いている場合にフォーカスを合わせます
+ event.waitUntil(clients.matchAll({
+ type: "window"
+ }).then(function(clientList) {
+ for (var i = 0; i &lt; clientList.length; i++) {
+ var client = clientList[i];
+ if (client.url == '/' &amp;&amp; 'focus' in client) {
+ client.focus();
+ break;
+  }
+ }
+ if (clients.openWindow)
+ return clients.openWindow('/');
+ }));
+});</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Service Workers', '#windowclient', 'WindowClient')}}</td>
+ <td>{{Spec2('Service Workers')}}</td>
+ <td>初期定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.WindowClient")}}</p>
+</div>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li><a href="/ja/docs/Web/API/ServiceWorker_API/Using_Service_Workers">Service worker の使用</a></li>
+ <li><a href="https://github.com/mdn/sw-test">サービスワーカーの基本的なコード例</a>(英語)</li>
+ <li><a href="https://jakearchibald.github.io/isserviceworkerready/">ServiceWorker の準備はできていますか?</a>(英語)</li>
+ <li><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a></li>
+ <li><a href="/ja/docs/Web/Guide/Performance/Using_web_workers">Web worker の使用</a></li>
+ <li><a href="/ja/docs/Web/API/Channel_Messaging_API">Channel Messaging API</a></li>
+</ul>
diff --git a/files/ja/web/api/windowclient/navigate/index.html b/files/ja/web/api/windowclient/navigate/index.html
new file mode 100644
index 0000000000..9ff778bdd2
--- /dev/null
+++ b/files/ja/web/api/windowclient/navigate/index.html
@@ -0,0 +1,57 @@
+---
+title: WindowClient.navigate()
+slug: Web/API/WindowClient/navigate
+tags:
+ - API
+ - Method
+ - Navigate
+ - Reference
+ - Service Workers
+ - WindowClient
+translation_of: Web/API/WindowClient/navigate
+---
+<p>{{APIRef("Service Workers API")}}</p>
+
+<p><span class="seoSummary">{{domxref("WindowClient")}} インターフェイスの <strong><code>navigate()</code></strong> メソッドは、指定された URL を制御されたクライアントのページに読み込んでから、既存の {{domxref("WindowClient")}} に解決される {{jsxref("Promise")}} を返します。</span></p>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox"><em>windowClient</em>.navigate(<em>url</em>).then(function(<em>windowClient</em>) {
+ // ナビゲーション後に WindowClient で何かを行います
+});</pre>
+
+<h3 id="Parameters" name="Parameters">パラメーター</h3>
+
+<dl>
+ <dt><code>url</code></dt>
+ <dd>ナビゲートする場所。</dd>
+</dl>
+
+<h3 id="Return_value" name="Return_value">戻り値</h3>
+
+<p>既存の {{domxref("WindowClient")}} に解決される {{jsxref("Promise")}}。</p>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Service Workers', '#dom-windowclient-navigate', 'navigate()')}}</td>
+ <td>{{Spec2('Service Workers')}}</td>
+ <td>初期定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.WindowClient.navigate")}}</p>
+</div>
diff --git a/files/ja/web/api/windowclient/visibilitystate/index.html b/files/ja/web/api/windowclient/visibilitystate/index.html
new file mode 100644
index 0000000000..121f7379d5
--- /dev/null
+++ b/files/ja/web/api/windowclient/visibilitystate/index.html
@@ -0,0 +1,69 @@
+---
+title: WindowClient.visibilityState
+slug: Web/API/WindowClient/visibilityState
+tags:
+ - API
+ - Property
+ - Reference
+ - Service Workers
+ - ServiceWorker
+ - WindowClient
+ - visibilityState
+translation_of: Web/API/WindowClient/visibilityState
+---
+<div>{{APIRef("Service Workers API")}}</div>
+
+<p><span class="seoSummary">{{domxref("WindowClient")}} インターフェイスの <strong><code>visibilityState</code></strong> 読み取り専用プロパティは、現在のクライアントの可視性を示します。 この値は、<code>"hidden"</code>、<code>"visible"</code>、<code>"prerender"</code> のいずれかです。</span></p>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox">var <em>myVisState</em> = <em>windowClient</em>.visibilityState;</pre>
+
+<h3 id="Value" name="Value">値</h3>
+
+<p>{{domxref("DOMString")}}(値については、{{domxref("Document.visibilityState")}} を参照)。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre class="brush: js">event.waitUntil(clients.matchAll({
+ type: "window"
+ }).then(function(clientList) {
+ for (let i = 0; i &lt; clientList.length; i++) {
+ let client = clientList[i];
+ if (client.url == '/' &amp;&amp; 'focus' in client) {
+ if (client.visibilityState === 'hidden')
+ return client.focus();
+ }
+ }
+ }
+
+ if (clients.openWindow) {
+ return clients.openWindow('/');
+ }
+ }));
+});</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table" style="line-height: 19.0909080505371px;">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Service Workers', '#dom-windowclient-visibilitystate', 'visibilityState')}}</td>
+ <td>{{Spec2('Service Workers')}}</td>
+ <td>初期定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.WindowClient.visibilityState")}}</p>
+</div>