StorageAccessHandle: estimate() 方法

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

注意: 請參閱 StorageManager.estimate() 以瞭解用法。

語法

js
estimate()

引數

無。

返回值

一個 Promise,它會解析為一個未分割槽的 StorageEstimate 物件。

異常

SecurityError DomException

如果未授予訪問許可權,則丟擲此異常。

請參閱 StorageManager.estimate()

示例

js
document.requestStorageAccess({ estimate: true }).then(
  (handle) => {
    console.log("estimate access granted");
    await handle.estimate();
  },
  () => {
    console.log("estimate access denied");
  },
);

注意:有關更完整的示例,請參閱使用 Storage Access API

規範

規範
將儲存訪問API(SAA)擴充套件到非Cookie儲存
# dom-storageaccesshandle-estimate

瀏覽器相容性

另見