WorkletSharedStorage: keys() method

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.

The keys() method of the WorkletSharedStorage interface returns an async iterator, which contains the keys for each item in a WorkletSharedStorage instance.

Syntax

js
keys()

Parameters

None.

Return value

An array of the WorkletSharedStorage's enumerable property keys.

Exceptions

TypeError

Thrown if the calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.

Examples

js
// keys() available inside a shared storage worklet module
const storage = await this.sharedStorage;

async function logKeys() {
  for await (const key of storage.keys()) {
    console.log(key);
  }
}

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also