Back to Content

WorkletSharedStorage: keys() method

files/en-us/web/api/workletsharedstorage/keys/index.md

latest1.0 KB
Original Source

{{APIRef("Shared Storage API")}}{{deprecated_header}}

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

Syntax

js-nolint
keys()

Parameters

None.

Return value

An array of the WorkletSharedStorage's enumerable property keys.

Exceptions

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

{{Specifications}}

Browser compatibility

{{Compat}}

See also