Window:sharedStorage 屬性
全域性只讀的 sharedStorage 屬性返回當前源的 WindowSharedStorage 物件。這是使用 Shared Storage API 將資料寫入共享儲存的主要入口點。
注意: sharedStorage 在 worker 中不可用。它由 Window 實現,在共享儲存 worklet 中也可用(請參閱 SharedStorageWorkletGlobalScope.sharedStorage,它返回 WorkletSharedStorage)。
值
一個 WindowSharedStorage 物件例項。
示例
js
window.sharedStorage
.set("ab-testing-group", "0")
.then(() => console.log("Value saved to shared storage"));
規範
| 規範 |
|---|
| 共享儲存 API # dom-window-sharedstorage |
瀏覽器相容性
載入中…