From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../ja/web/api/storagemanager/estimate/index.html | 104 +++++++++++++++++++++ files/ja/web/api/storagemanager/index.html | 53 +++++++++++ files/ja/web/api/storagemanager/persist/index.html | 59 ++++++++++++ .../ja/web/api/storagemanager/persisted/index.html | 59 ++++++++++++ 4 files changed, 275 insertions(+) create mode 100644 files/ja/web/api/storagemanager/estimate/index.html create mode 100644 files/ja/web/api/storagemanager/index.html create mode 100644 files/ja/web/api/storagemanager/persist/index.html create mode 100644 files/ja/web/api/storagemanager/persisted/index.html (limited to 'files/ja/web/api/storagemanager') diff --git a/files/ja/web/api/storagemanager/estimate/index.html b/files/ja/web/api/storagemanager/estimate/index.html new file mode 100644 index 0000000000..aaa52aae3f --- /dev/null +++ b/files/ja/web/api/storagemanager/estimate/index.html @@ -0,0 +1,104 @@ +--- +title: StorageManager.estimate() +slug: Web/API/StorageManager/estimate +tags: + - API + - Method + - Quota + - Reference + - Secure context + - Storage + - Storage API + - StorageManager + - Usage + - estimate + - メソッド +translation_of: Web/API/StorageManager/estimate +--- +

{{securecontext_header}}{{APIRef("Storage")}}

+ +

estimate() は {{domxref("StorageManager")}} インターフェイスのメソッドで、ストレージマネージャーに、現在のオリジンが使用しているストレージの大きさ (usage) と、利用可能な空間の量 (quota) を要求します。

+ +

このメソッドは非同期的に動作するので、情報が利用可能になると解決する {{jsxref("Promise")}} を返します。プロミスの成功ハンドラーは、使用量とクォータのデータを含む {{domxref("StorageEstimate")}} を入力として受け取ります。

+ +

構文

+ +
const estimatePromise = StorageManager.estimate();
+ +

引数

+ +

なし。

+ +

返値

+ +

{{jsxref('Promise')}} で、これは {{domxref('StorageEstimate')}} 辞書に準拠したオブジェクトに解決します。この辞書には、このオリジンで利用可能なおよその大きさが {{domxref("StorageEstimate.quota")}} に、現在使用されているおよその量が {{domxref("StorageEstimate.usage")}} に入ります。

+ +
+

これらは正確な数値ではありません。圧縮、重複排除セキュリティ上の理由による難読化などが行われるため、正確な値にはなりません。

+
+ +

quota はオリジンごとに異なることに気づくかもしれません。この違いは次のような要因に基づきます。

+ + + +

+ +

この例では、使用量の概算値を取得し、現在使用しているストレージ容量のパーセント値をユーザーに提示します。

+ +

HTML の内容

+ +
<label>
+  現在、使用可能なストレージの約 <output id="percent">
+  </output>% を使用しています。
+</label>
+
+ +

JavaScript の内容

+ +
navigator.storage.estimate().then(function(estimate) {
+  document.getElementById("percent").value =
+      (estimate.usage / estimate.quota * 100).toFixed(2);
+});
+
+ +

結果

+ +

{{ EmbedLiveSample('Example', 600, 40) }}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('Storage','#dom-storagemanager-estimate','estimate()')}}{{Spec2('Storage')}}初回定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.StorageManager.estimate")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/storagemanager/index.html b/files/ja/web/api/storagemanager/index.html new file mode 100644 index 0000000000..21c5ebcaee --- /dev/null +++ b/files/ja/web/api/storagemanager/index.html @@ -0,0 +1,53 @@ +--- +title: StorageManager +slug: Web/API/StorageManager +tags: + - API + - Interface + - Persistence + - Quotas + - Reference + - Secure context + - Storage + - Storage API + - StorageManager + - Usage +translation_of: Web/API/StorageManager +--- +

{{securecontext_header}}{{SeeCompatTable}}{{APIRef("Storage")}}

+ +

Storage APIStorageManager インターフェイスは、永続性のパーミッションの管理と、利用可能なストレージの見積もりのインターフェイスを提供します。{{domxref("navigator.storage")}} か {{domxref("WorkerNavigator.storage")}} のいずれかを使用して、このインターフェイスへの参照を取得できます。

+ +

メソッド

+ +
+
{{domxref("StorageManager.estimate()")}} {{securecontext_inline}}
+
オリジンの使用量とクォータを含む {{domxref("StorageEstimate")}} オブジェクトを返します。
+
{{domxref("StorageManager.persist()")}} {{securecontext_inline}}
+
ユーザーエージェントがサイトのストレージを永続化できる場合に true に解決される {{jsxref('Promise')}} を返します。
+
{{domxref("StorageManager.persisted()")}} {{securecontext_inline}}
+
サイトのストレージに永続性がすでに付与されている場合に true に解決される {{jsxref('Promise')}} を返します。
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Storage','#storagemanager','StorageManger')}}{{Spec2('Storage')}}初期定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.StorageManager")}}

diff --git a/files/ja/web/api/storagemanager/persist/index.html b/files/ja/web/api/storagemanager/persist/index.html new file mode 100644 index 0000000000..eecad3accc --- /dev/null +++ b/files/ja/web/api/storagemanager/persist/index.html @@ -0,0 +1,59 @@ +--- +title: StorageManager.persist() +slug: Web/API/StorageManager/persist +tags: + - Method + - Reference + - Secure context + - Storage API + - persist() +translation_of: Web/API/StorageManager/persist +--- +

{{securecontext_header}}{{APIRef("Storage")}}{{SeeCompatTable}}

+ +

{{domxref("StorageManager")}} インターフェイスの persist() メソッドは、永続的ストレージ(persistent storage)を使用するパーミッションを要求します。 そして、パーミッションが付与されてボックスモードが永続的な場合は true に、そうでない場合は false に解決される {{jsxref("Promise")}} を返します。

+ +

構文

+ +
navigator.storage.persist().then(function(persistent) { ... })
+ +

パラメーター

+ +

なし。

+ +

戻り値

+ +

{{jsxref('Boolean')}} に解決される {{jsxref("Promise")}}。

+ +

+ +
if (navigator.storage && navigator.storage.persist)
+  navigator.storage.persist().then(function(persistent) {
+    if (persistent)
+      console.log("明示的なユーザー操作以外では、ストレージは消去されません。");
+    else
+      console.log("ストレージは UA によってストレージの圧力により消去されるかもしれません。");
+  });
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Storage','#dom-storagemanager-persist','persist')}}{{Spec2('Storage')}}初期定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.StorageManager.persist")}}

diff --git a/files/ja/web/api/storagemanager/persisted/index.html b/files/ja/web/api/storagemanager/persisted/index.html new file mode 100644 index 0000000000..116fa8cddb --- /dev/null +++ b/files/ja/web/api/storagemanager/persisted/index.html @@ -0,0 +1,59 @@ +--- +title: StorageManager.persisted() +slug: Web/API/StorageManager/persisted +tags: + - Method + - Reference + - Secure context + - Storage API + - persisted() +translation_of: Web/API/StorageManager/persisted +--- +

{{securecontext_header}}{{APIRef("Storage")}}{{SeeCompatTable}}

+ +

{{domxref("StorageManager")}} インターフェイスの persisted() メソッドは、サイトのストレージに対してボックスモードが永続的であれば true に解決される {{jsxref("Promise")}} を返します。

+ +

構文

+ +
navigator.storage.persisted().then(function(persistent) { ... })
+ +

パラメーター

+ +

なし。

+ +

戻り値

+ +

{{jsxref('Boolean')}} に解決される {{jsxref("Promise")}}。

+ +

+ +
if (navigator.storage && navigator.storage.persist)
+  navigator.storage.persisted().then(function(persistent) {
+    if (persistent)
+      console.log("明示的なユーザー操作以外では、ストレージは消去されません。");
+    else
+      console.log("ストレージは UA によってストレージの圧力により消去されるかもしれません。");
+  });
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Storage','#dom-storagemanager-persisted','persisted')}}{{Spec2('Storage')}}初期定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.StorageManager.persisted")}}

-- cgit v1.2.3-54-g00ecf