Back to Content

WorkletSharedStorage: entries() method

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

latest1.3 KB
Original Source

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

The entries() method of the {{domxref("WorkletSharedStorage")}} interface returns an async iterator. The iterator provides an array of [key, value] pairs corresponding to the enumerable properties of a WorkletSharedStorage instance. The order of these pairs is similar to that in a for...in loop, though a for...in loop also enumerates properties from the prototype chain.

Syntax

js-nolint
entries()

Parameters

None.

Return value

An array of the WorkletSharedStorage's enumerable property key-value pairs.

Exceptions

Examples

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

async function logEntries() {
  for await (const [key, value] of storage.entries()) {
    console.log({ key, value });
  }
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also