SharedStorage
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Giao diện SharedStorage của Shared Storage API đại diện cho bộ lưu trữ chia sẻ của một nguồn gốc cụ thể, định nghĩa các phương thức để ghi dữ liệu vào bộ lưu trữ chia sẻ.
SharedStorage là lớp cơ sở cho:
WindowSharedStorage, truy cập quaWindow.sharedStorage.WorkletSharedStorage, truy cập quaSharedStorageWorkletGlobalScope.sharedStorage.
Phương thức phiên bản
append()Deprecated-
Nối thêm một chuỗi vào giá trị của một cặp key-value hiện có trong bộ lưu trữ chia sẻ của nguồn gốc hiện tại.
clear()Deprecated-
Xóa bộ lưu trữ chia sẻ của nguồn gốc hiện tại, xóa toàn bộ dữ liệu.
delete()Deprecated-
Xóa một cặp key-value hiện có khỏi bộ lưu trữ chia sẻ của nguồn gốc hiện tại.
set()Deprecated-
Lưu trữ một cặp key-value mới trong bộ lưu trữ chia sẻ của nguồn gốc hiện tại hoặc cập nhật cặp hiện có.
Ví dụ
window.sharedStorage
.set("ab-testing-group", "0")
.then(() => console.log("Value saved to shared storage"));
Thông số kỹ thuật
| Specification |
|---|
| Shared Storage API> # sharedstorage> |