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

浏览器兼容性

另见