Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arichiv committed May 3, 2024
1 parent bf60b5d commit f6e4023
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 0 deletions.
1 change: 1 addition & 0 deletions files/en-us/web/api/document/requeststorageaccess/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ document.requestStorageAccess().then(
document.requestStorageAccess({ localStorage: true }).then(
(handle) => {
console.log("localStorage access granted");
handle.localStorage.setItem("foo", "bar");
},
() => {
console.log("localStorage access denied");
Expand Down
45 changes: 45 additions & 0 deletions files/en-us/web/api/storageaccesshandle/caches/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "StorageAccessHandle: caches property"
short-title: caches
slug: Web/API/StorageAccessHandle/caches
page-type: web-api-instance-property
browser-compat: api.StorageAccessHandle.caches
---

{{APIRef("Storage Access API")}}

The **`caches`** property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned {{domxref("CacheStorage")}} object if access was granted, and throws a `SecurityError` {{DOMxRef("DOMException")}} otherwise.

## Value

A {{domxref("CacheStorage")}} object.

## Examples

```js
document.requestStorageAccess({ caches: true }).then(
(handle) => {
console.log("caches access granted");
const cache = await handle.caches.open("foo");
await cache.add("/");
},
() => {
console.log("caches access denied");
},
);
```

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.
## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
44 changes: 44 additions & 0 deletions files/en-us/web/api/storageaccesshandle/indexeddb/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "StorageAccessHandle: indexedDB property"
short-title: indexedDB
slug: Web/API/StorageAccessHandle/indexedDB
page-type: web-api-instance-property
browser-compat: api.StorageAccessHandle.indexedDB
---

{{APIRef("Storage Access API")}}

The **`indexedDB`** property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned {{domxref("IDBFactory")}} object if access was granted, and throws a `SecurityError` {{DOMxRef("DOMException")}} otherwise.

## Value

A {{domxref("IDBFactory")}} object.

## Examples

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

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.
## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
44 changes: 44 additions & 0 deletions files/en-us/web/api/storageaccesshandle/localstorage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "StorageAccessHandle: localStorage property"
short-title: localStorage
slug: Web/API/StorageAccessHandle/localStorage
page-type: web-api-instance-property
browser-compat: api.StorageAccessHandle.localStorage
---

{{APIRef("Storage Access API")}}

The **`localStorage`** property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned local {{domxref("Storage")}} object if access was granted, and throws a `SecurityError` {{DOMxRef("DOMException")}} otherwise.

## Value

A {{domxref("Storage")}} object.

## Examples

```js
document.requestStorageAccess({ localStorage: true }).then(
(handle) => {
console.log("localStorage access granted");
handle.localStorage.setItem("foo", "bar");
},
() => {
console.log("localStorage access denied");
},
);
```

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.
## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
46 changes: 46 additions & 0 deletions files/en-us/web/api/storageaccesshandle/locks/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: "StorageAccessHandle: locks property"
short-title: locks
slug: Web/API/StorageAccessHandle/locks
page-type: web-api-instance-property
browser-compat: api.StorageAccessHandle.locks
---

{{APIRef("Storage Access API")}}

The **`locks`** property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned session {{domxref("LockManager")}} object if access was granted, and throws a `SecurityError` {{DOMxRef("DOMException")}} otherwise.

## Value

A {{domxref("LockManager")}} object.

## Examples

```js
document.requestStorageAccess({ locks: true }).then(
(handle) => {
console.log("locks access granted");
await handle.locks.request('foo', async lock => {
return "ok";
});
},
() => {
console.log("locks access denied");
},
);
```

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.
## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
44 changes: 44 additions & 0 deletions files/en-us/web/api/storageaccesshandle/sessionstorage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "StorageAccessHandle: sessionStorage property"
short-title: sessionStorage
slug: Web/API/StorageAccessHandle/sessionStorage
page-type: web-api-instance-property
browser-compat: api.StorageAccessHandle.sessionStorage
---

{{APIRef("Storage Access API")}}

The **`sessionStorage`** property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned session {{domxref("Storage")}} object if access was granted, and throws a `SecurityError` {{DOMxRef("DOMException")}} otherwise.

## Value

A {{domxref("Storage")}} object.

## Examples

```js
document.requestStorageAccess({ sessionStorage: true }).then(
(handle) => {
console.log("sessionStorage access granted");
handle.sessionStorage.setItem("foo", "bar");
},
() => {
console.log("sessionStorage access denied");
},
);
```

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.
## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)

0 comments on commit f6e4023

Please sign in to comment.