StorageAccessHandle: phương thức getDirectory()

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: Xem StorageManager.getDirectory() để hiểu cách sử dụng.

Cú pháp

js
getDirectory()

Tham số

Không có.

Giá trị trả về

Một Promise được thực hiện với một đối tượng FileSystemDirectoryHandle không phân vùng.

Ngoại lệ

SecurityError DomException

Được ném ra nếu quyền truy cập không được cấp.

Xem StorageManager.getDirectory()

Ví dụ

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

Note: Xem Using the Storage Access API để biết ví dụ đầy đủ hơn.

Thông số kỹ thuật

Thông số kỹ thuật
Extending Storage Access API (SAA) to non-cookie storage
# dom-storageaccesshandle-getdirectory

Tương thích trình duyệt

Xem thêm